borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (verify username and password using VB6 and msaccess)Next Topic (Password) New Topic New Poll Post Reply
AndreaVB Forum : Database : Updating list bos
Poster Message
shuj66
Level: Guest


icon Updating list bos  Archived to Disk

Hi I have two forms - frm1 and frm2

frm1 has displays many fields from a db table, it also has a list box that show some important info(like status).
There is one field called status and next to it a button called changeStutus. When this button is clicked, a new frm2 comes up.

frm2 has a combo box which lists the different options like
Open, on-hold and and closed plus some other fields.

So, if frm1 has status as open and I want to change it to on-hold then I click changestatus button and frm2 opens up and I click the combo box and select on Hold. When I exit out of this form, I want the change to be shown in frm1 Status field and the list box.

What happens right now is that , it makes the change on the first record all the time. How do I get it to change the record that is selected and not the first one all the time. What is wrong with my code.

With Adodc1

Select Case Index

Case 0 'Add
If cmdAction(0).Caption = "&Add" Then
varBookMark = .Recordset.Bookmark
.Recordset.AddNew
lblDate.Caption = Format(myDate, "Medium Date")
lblTime.Caption = myTime
lblUserName = UserName
lblTicketID.Caption = frmTB.txtFields(0).Text
txtComments.Text = ""
txtComments.SetFocus
cmdAction(0).Caption = "&Cancel"
SetVisible False
Else
.Recordset.CancelUpdate
If varBookMark > 0 Then
.Recordset.Bookmark = varBookMark
Else
.Recordset.MoveFirst
End If
cmdAction(Index).Caption = "&Add"
SetVisible True
End If


Case 1 'Update

.Recordset.Update
varBookMark = .Recordset.Bookmark
.Recordset.Requery
If varBookMark > 0 Then
.Recordset.Bookmark = varBookMark
Else
.Recordset.MoveLast
End If
cmdAction(0).Caption = "&Add"
'update changes in the TB form
frmTB.txtFields(2).Text =
frmChangeStatus.Combo1.Text
get_connected
Update_Fields
frmTB.Refresh
Fill_Combos


Case 2 'Exit
.Refresh
Unload Me
TB.Refresh
End Select

End With

Exit Sub

Sub Fill_Combos()
frmTB.List1.Clear

Do While Not rs.EOF
'On Error Resume Next
frmTB.List1.AddItem rs!TicketID & " " & rs!CustID & " " & rs!TicketStatus
rs.MoveNext
Loop

End Sub

22-05-2002 at 08:54 PM
| Quote Reply
JLRodgers
Level: Moderator

Registered: 04-04-2002
Posts: 1617
icon Re: Updating list bos  Archived to Disk

Didn't see anything offhand, but, did you try to set a breakpoint on the "With Adodc1", and then step through the code to see exactly what it's doing? It'd probably be obvious then to you. (you step line by line with F8)

Although if varBookMark isn't declared as private to the form, or static in the proceedure, it's value would be 0 everytime the code you posted started, which may be a problem, but not sure (I've never needed to use bookmarks).

22-05-2002 at 09:51 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaVB Forum : Database : Updating list bos
Previous Topic (verify username and password using VB6 and msaccess)Next Topic (Password) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder