Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recordset.FindFirst not working

Status
Not open for further replies.

mhansler

Technical User
Feb 19, 2001
24
US
I have a drop down list to select criteria. After selecting from the list, record in form does not move. Please help. :(


Private Sub Combo54_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
Recordset.FindFirst "[Vendor] = '" & Me![Combo54] & "'"
Me.Bookmark = rs.Bookmark
End Sub
 
Try like this, hope it help.


Private Sub Combo54_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
Recordset.FindFirst "[Vendor] = " & Me![Combo54]
Me.Bookmark = rs.Bookmark
End Sub

-------------------------
Regards
JoaoTL
-------------------------

 
Looks like your code has a wee too many quotes in it.

You have:
Recordset.FindFirst "[Vendor] = '" & Me![Combo54] & "'"
Try this:
Recordset.FindFirst "[Vendor] = " & Me![Combo54]

This should alleviate the problem.




 
Thank you for your help, but no, that did not appear to work either. I've since deleted and re-created the box with the wizard, with always the same results. I am using a query to pull the combo box data from, that is sorted in ascending order. I don't see how that could be causing it, but I thought I'd mention it. I've enclosed the code. It's not very complicated therefore frustrating to figure out what's wrong.

Option Compare Database
Option Explicit

Private Sub Form_AfterUpdate()

Me.AllowEdits = False 'Return the form to read only status. (M. Hansler)
MsgBox "Funeral Home Record has been updated!"
End Sub

Private Sub Form_Current()
Me.AllowEdits = False 'Return the form to read only status. (M. Hansler)
End Sub

Private Sub FuneralHomeAddRecord_Click()
On Error GoTo Err_FuneralHomeAddRecord_Click


DoCmd.GoToRecord , , acNewRec

Exit_FuneralHomeAddRecord_Click:
Exit Sub

Err_FuneralHomeAddRecord_Click:
MsgBox Err.Description
Resume Exit_FuneralHomeAddRecord_Click

End Sub

Private Sub FuneralHomeEditRecord_Click()
'to allows edits to the Funeral Home Table. (M. Hansler)
Me.AllowEdits = True
Vendor.SetFocus
Combo57 = Vendor 'Update the Find Record Combo box as user moves through records
End Sub
Private Sub FuneralHomeSaveRecord_Click()
On Error GoTo Err_FuneralHomeSaveRecord_Click


DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

Exit_FuneralHomeSaveRecord_Click:
Exit Sub

Err_FuneralHomeSaveRecord_Click:
MsgBox Err.Description
Resume Exit_FuneralHomeSaveRecord_Click

End Sub


Private Sub Combo57_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Vendor] = '" & Me![Combo57] & "'"
Me.Bookmark = rs.Bookmark
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top