Error in finding field

J

Jan Il

Hi All - Access 2002XP - Win XP Pro

I have the code below behind a button on a filter form to check the various
combo boxes for data and then open the record form to display the
information accordingly. I am getting the following error when I click the
button.

"Microsoft Access can't find the filed cmbReservations referred to in your
expression."

I have checked the field on record form and it is Reservations, the control
on the filter form is cmbReservations. So, I am confused as to where the
error is stemming from. All the others are working without errors.

***********************Start Code**********************

Private Sub cmdExpResearch_Click()
On Error GoTo Err_cmdExpResearch_Click

Dim strWhere As String

Dim stDocName As String
Dim stLinkCriteria As String

strWhere = ""
' do EventName
If IsNull(Me!cmbEventName) = False Then
strWhere = "[EventName]=" & """" & Me![cmbEventName] & """"
End If

Me![cmbEventName] = Null


' do Location
If IsNull(Me!cmbEventLocation) = False Then
If strWhere <> "" Then strWhere = strWhere & " and "
strWhere = strWhere & "[EventLocation]=" & "'" & Me![cmbEventLocation] &
"'"
End If

Me![cmbEventLocation] = Null

' do RSVPs

If IsNull(Me!cmbEventRSVPs) = False Then
If strWhere <> "" Then strWhere = strWhere & " and "
strWhere = strWhere & "[EventRSVPs]=" & "'" & Me![cmbEventRSVPs] & "'"
End If

Me![cmbEventRSVPs] = Null

' do Reservations

If IsNull(Me!cmbReservations) = False Then
If strWhere <> "" Then strWhere = strWhere & " and "
strWhere = strWhere & "[Reservations]=" & "'" & Me![cmbReservations] &
"'"
End If

Me![cmbReservations] = Null

stDocName = "frmEventsRegister"

stLinkCriteria = strWhere
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdExpResearch_Click:
Exit Sub

Err_cmdExpResearch_Click:
MsgBox Err.Description
Resume Exit_cmdExpResearch_Click

End Sub
********************End Code*************

I would really appreciate it if somone would give some input as to where I
might look to troubleshoot this error further. Obviously, I am missing
something somewhere.

Jan :)
MS MVP - IE/OE
Smiles are meant to be shared,
that's why they're so contagious.
 
D

Douglas J. Steele

Hate to ask, but you sure the control is named cmbReservations: that you
didn't mistype it in one place or another?
 
J

Jan Il

Hi Doug :)
Hate to ask, but you sure the control is named cmbReservations: that you
didn't mistype it in one place or another?

No...nothing mis-spelled. I had actually checked it several times before
posting here, but, gave it another careful go over after your reply, just to
be especially sure. I decided to try the 'ol 'throw everything into a new
db and see what happens' trick, and I guess it must have been something in
the mix somewhere that didn't like the old decor. Everything is now working
as it should. I was afraid it was another ghost form <whew!>

Thank you very much for your time and help. I really appreciate it. :)

Jan :)
MS MVP - IE/OE
Smiles are meant to be shared,
that's why they're so contagious.
--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Jan Il said:
Hi All - Access 2002XP - Win XP Pro

I have the code below behind a button on a filter form to check the
various combo boxes for data and then open the record form to display the
information accordingly. I am getting the following error when I click
the button.

"Microsoft Access can't find the filed cmbReservations referred to in
your expression."

I have checked the field on record form and it is Reservations, the
control on the filter form is cmbReservations. So, I am confused as to
where the error is stemming from. All the others are working without
errors.

***********************Start Code**********************

Private Sub cmdExpResearch_Click()
On Error GoTo Err_cmdExpResearch_Click

Dim strWhere As String

Dim stDocName As String
Dim stLinkCriteria As String

strWhere = ""
' do EventName
If IsNull(Me!cmbEventName) = False Then
strWhere = "[EventName]=" & """" & Me![cmbEventName] & """"
End If

Me![cmbEventName] = Null


' do Location
If IsNull(Me!cmbEventLocation) = False Then
If strWhere <> "" Then strWhere = strWhere & " and "
strWhere = strWhere & "[EventLocation]=" & "'" & Me![cmbEventLocation]
& "'"
End If

Me![cmbEventLocation] = Null

' do RSVPs

If IsNull(Me!cmbEventRSVPs) = False Then
If strWhere <> "" Then strWhere = strWhere & " and "
strWhere = strWhere & "[EventRSVPs]=" & "'" & Me![cmbEventRSVPs] & "'"
End If

Me![cmbEventRSVPs] = Null

' do Reservations

If IsNull(Me!cmbReservations) = False Then
If strWhere <> "" Then strWhere = strWhere & " and "
strWhere = strWhere & "[Reservations]=" & "'" & Me![cmbReservations] &
"'"
End If

Me![cmbReservations] = Null

stDocName = "frmEventsRegister"

stLinkCriteria = strWhere
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdExpResearch_Click:
Exit Sub

Err_cmdExpResearch_Click:
MsgBox Err.Description
Resume Exit_cmdExpResearch_Click

End Sub
********************End Code*************

I would really appreciate it if somone would give some input as to where
I might look to troubleshoot this error further. Obviously, I am missing
something somewhere.

Jan :)
MS MVP - IE/OE
Smiles are meant to be shared,
that's why they're so contagious.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top