zippy221
asked on
Accessing Recordset for Data Control
I have a dbCombo box that uses the objAcctInfo1 datacontrol. I want to be able to select a name from the combo box and then when I press a button, it will set the variable strTitle1 to the Title for that name in the database...my problem is that when I debug this code it is always at the first record of the recordset, not at the record I need. I just need to know how to move the pointer to the record I need...what would I add to this code to do that? It would need to point to the record where cboName = the Name field in the objAcctInfo1 data control recordset.
With Me.objAcctInfo1.Recordset
.OpenRecordset
strTitle1 = ![Title]
.Close
End With
Thanks,
Zippy221
With Me.objAcctInfo1.Recordset
.OpenRecordset
strTitle1 = ![Title]
.Close
End With
Thanks,
Zippy221
Hi Zippy,
Try moving to the record using .Movenext or .Move (Record Number).
-Mudasir.
Try moving to the record using .Movenext or .Move (Record Number).
-Mudasir.
ASKER
How do I know what the record number is?
ASKER
I tried leaving out the close and open recordset, but that doesn't seem to work either...
using text property of dbcombo?
ASKER
That doesn't work either...here is what I tried:
Dim strTitle1 As String
Dim SearchCriteria1 As String
SearchCriteria1 = "[Employee]= " & Chr$(34) & cboAccountInformation1 & Chr$(34)
With Me.objAcctInfo1.Recordset
.FindFirst SearchCriteria1
strTitle1 = ![Title]
End With
When I debug it the search criteria is okay, but the title doesn't change it is still not moving to the record it is on...
Dim strTitle1 As String
Dim SearchCriteria1 As String
SearchCriteria1 = "[Employee]= " & Chr$(34) & cboAccountInformation1 & Chr$(34)
With Me.objAcctInfo1.Recordset
.FindFirst SearchCriteria1
strTitle1 = ![Title]
End With
When I debug it the search criteria is okay, but the title doesn't change it is still not moving to the record it is on...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
You are a awesome! Thanks!
yeah, yeah, i know :)))
Thanks for "A" grade!
Thanks for "A" grade!
With Me.objAcctInfo1.Recordset
strTitle1 = ![Title]
End With