PDA

View Full Version : MoveNext


newjack
09-30-03, 14:30
I have some vba code that will not work properly .. can someone help ... the Db contains 3 records but the form only displays 2 ... what am i doing wrong

Private Sub cmdNext_Click()

Rec.Open "tblRequest", Conn, adOpenDynamic, adLockOptimistic
If Not Rec.EOF = True Then Rec.MoveNext

txtChangeID.Value = Rec("ChangeID")
txtStatus.Value = Rec("Status")
cboRequestor.Value = Rec("Requestor")
txtRequestDate.Value = Rec("RequestDate")
txtCompRequestDate.Value = Rec("CompRequestDate")
cboBusinessArea.Value = Rec("BusinessArea")
cboContactPerson.Value = Rec("ContactPerson")
txtBriefDescrip.Value = Rec("BriefDescrip")
txtDescripofChange.Value = Rec("DescripofChange")
cboDeptPriority.Value = Rec("DeptPriority")
txtBusinessDrivers.Value = Rec("BusinessDrivers")
cboReactionChannel.Value = Rec("ReactionChannel")
cboTypeofChange.Value = Rec("TypeofChange")
cboApplication.Value = Rec("Application")

Rec.Close

End Sub

RickKnight
09-30-03, 15:59
What is the db base type (i.e. access) and how are you displaying it in your form (flexgrid, or in text boxes)?


I have some vba code that will not work properly .. can someone help ... the Db contains 3 records but the form only displays 2 ... what am i doing wrong

Private Sub cmdNext_Click()

Rec.Open "tblRequest", Conn, adOpenDynamic, adLockOptimistic
If Not Rec.EOF = True Then Rec.MoveNext

txtChangeID.Value = Rec("ChangeID")
txtStatus.Value = Rec("Status")
cboRequestor.Value = Rec("Requestor")
txtRequestDate.Value = Rec("RequestDate")
txtCompRequestDate.Value = Rec("CompRequestDate")
cboBusinessArea.Value = Rec("BusinessArea")
cboContactPerson.Value = Rec("ContactPerson")
txtBriefDescrip.Value = Rec("BriefDescrip")
txtDescripofChange.Value = Rec("DescripofChange")
cboDeptPriority.Value = Rec("DeptPriority")
txtBusinessDrivers.Value = Rec("BusinessDrivers")
cboReactionChannel.Value = Rec("ReactionChannel")
cboTypeofChange.Value = Rec("TypeofChange")
cboApplication.Value = Rec("Application")

Rec.Close

End Sub [/SIZE][/QUOTE]

newjack
10-01-03, 11:02
I am using a MS Access db ... and displaying it in text boxes.


Originally posted by RickKnight
What is the db base type (i.e. access) and how are you displaying it in your form (flexgrid, or in text boxes)?


I have some vba code that will not work properly .. can someone help ... the Db contains 3 records but the form only displays 2 ... what am i doing wrong

Private Sub cmdNext_Click()

Rec.Open "tblRequest", Conn, adOpenDynamic, adLockOptimistic
If Not Rec.EOF = True Then Rec.MoveNext

txtChangeID.Value = Rec("ChangeID")
txtStatus.Value = Rec("Status")
cboRequestor.Value = Rec("Requestor")
txtRequestDate.Value = Rec("RequestDate")
txtCompRequestDate.Value = Rec("CompRequestDate")
cboBusinessArea.Value = Rec("BusinessArea")
cboContactPerson.Value = Rec("ContactPerson")
txtBriefDescrip.Value = Rec("BriefDescrip")
txtDescripofChange.Value = Rec("DescripofChange")
cboDeptPriority.Value = Rec("DeptPriority")
txtBusinessDrivers.Value = Rec("BusinessDrivers")
cboReactionChannel.Value = Rec("ReactionChannel")
cboTypeofChange.Value = Rec("TypeofChange")
cboApplication.Value = Rec("Application")

Rec.Close

End Sub [/SIZE][/QUOTE]

RickKnight
10-01-03, 13:01
Your using a button to navigate the record with (or so it appears)? Why not use the ADODC control. What I'm seeing in this code is that you are are connecting to the access database through this button code and each time you click the button you reconnect (not a good method). I would (and 'I would' is the operative word) use the ADODC control to attach to the db tables and to navigate with. I think that if you changed the binding to the db to adodc (ado) you will populate the form with all records.
Good luck

Originally posted by newjack
I am using a MS Access db ... and displaying it in text boxes.


[/SIZE][/QUOTE]

newjack
10-01-03, 13:05
Can you tell me how to do that?


Originally posted by RickKnight
Your using a button to navigate the record with (or so it appears)? Why not use the ADODC control. What I'm seeing in this code is that you are are connecting to the access database through this button code and each time you click the button you reconnect (not a good method). I would (and 'I would' is the operative word) use the ADODC control to attach to the db tables and to navigate with. I think that if you changed the binding to the db to adodc (ado) you will populate the form with all records.
Good luck

[/SIZE][/QUOTE]