R
RLHartness
Guest
I've used Access for a little while on small projects here and there and I am just beginning to get the hang of Accesses in house VBA.
On a form I have a combo box at the top of my form that searches a table and then should output the data. The code for it is:
On Error GoTo ErrorHandler
Dim strSearch As String
strSearch = "[cltSSN] = " & Chr$(39) & Me![Combo160] & Chr$(39)
Me.Requery
Me.RecordsetClone.FindFirst strSearch
Me.Bookmark = Me.RecordsetClone.Bookmark
ErrorHandlerExit:
Exit Sub
ErrorHandler:
MsgBox "Error No: " & Err.Number & "; Description: " & Err.Description
Resume ErrorHandlerExit
Whenever the form is loaded no record is loaded. When I try to execute the search (either by typing in a name, or selecting a record from the drop down box) I receive the following error:
Error No: 3021; Description: No current record.
I would assume that there was an error with my code but there is one little problem. Whenever the form is loaded in form view, I switch to design view and then back to form view, the fiirst record is loaded and the search box works perfectly. I have been really confused with this and have not found a solution.
I would also like to point out that upon loading the form I have tried to immeadiately load a record, but this does not work and the I am not receiving any error messages.
If you can help please do.
Possible needed extra info:
Form load code that I tried:
Private Sub Form_Load()
DoCmd.GoToRecord , , acFirst
End Sub
On the form there is another combo box. It has a default value. I have no clue if this could be part of the problem, but I thought I would state it just in case.
Need any more information, please ask.
On a form I have a combo box at the top of my form that searches a table and then should output the data. The code for it is:
On Error GoTo ErrorHandler
Dim strSearch As String
strSearch = "[cltSSN] = " & Chr$(39) & Me![Combo160] & Chr$(39)
Me.Requery
Me.RecordsetClone.FindFirst strSearch
Me.Bookmark = Me.RecordsetClone.Bookmark
ErrorHandlerExit:
Exit Sub
ErrorHandler:
MsgBox "Error No: " & Err.Number & "; Description: " & Err.Description
Resume ErrorHandlerExit
Whenever the form is loaded no record is loaded. When I try to execute the search (either by typing in a name, or selecting a record from the drop down box) I receive the following error:
Error No: 3021; Description: No current record.
I would assume that there was an error with my code but there is one little problem. Whenever the form is loaded in form view, I switch to design view and then back to form view, the fiirst record is loaded and the search box works perfectly. I have been really confused with this and have not found a solution.
I would also like to point out that upon loading the form I have tried to immeadiately load a record, but this does not work and the I am not receiving any error messages.
If you can help please do.
Possible needed extra info:
Form load code that I tried:
Private Sub Form_Load()
DoCmd.GoToRecord , , acFirst
End Sub
On the form there is another combo box. It has a default value. I have no clue if this could be part of the problem, but I thought I would state it just in case.
Need any more information, please ask.