object required error with search button

Mrs.Meeker

Registered User.
Local time
Today, 15:55
Joined
Mar 28, 2003
Messages
172
I have a form with a combo box and a search button. Select a county and click search...but then get an error "object required".

I can't find a problem with my code and thought that perhaps someone could take a look. I'm sending all of it, (there is also an open button) just in case the problem is there...? This is in the early stages!

Thanks in advance! Rhonda

Option Compare Database

Private Sub cmd_open_Click()
On Error GoTo Err_cmd_open_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmProjectMasterDetail"

stLinkCriteria = "[Project Number]=" & "'" & Me![Project Number] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmd_open_Click:
Exit Sub

Err_cmd_open_Click:
MsgBox Err.Description
Resume Exit_cmd_open_Click

End Sub

Private Sub cmdSearch_Click()
On Error GoTo Err_cmdSearch_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmMasterList"

stLinkCriteria = "[County]=" & "'" & cmbCounty.Value & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdSearch_Click:
Exit Sub

Err_cmdSearch_Click:
MsgBox Err.Description
Resume Exit_cmdSearch_Click
End Sub
 
Hi,

Are you sure that 'frmMasterList' exists in your database?
And that the combobox 'cmdCounty' is on the first form?
 
Hey thanks!

Yes it's all there, but I got to looking at my file names and found that I had cmb_county and cmbCounty. I try to stay consistent but don't always manage.

I'd have never noticed without your input!
Thanks again,
Rhonda
 

Users who are viewing this thread

Back
Top Bottom