By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,678 Members | 2,377 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,678 IT Pros & Developers. It's quick & easy.

"Microsoft Access can't fine the field "|" referred to in your expression"

P: 48
Hello everyone,

I have created a search button but I receive the message "Microsoft Access can't fine the field "|" referred to in your expression" when I try to use it. I have looked online for this error but the fix did not pertain to this problem because the table or field name did not match any reservered Access words as described.

My records search form will have two combo boxes and one or two search buttons. I am just trying to get one to work before I even create the 2nd combo box.

What I want is the command button to run a query and return any records that match what is in the combo box.

For Example:
My combo box is named CboTitleSearch
My command button is named CmdSearchByTitle
Combo Box is selecting from the table "Titles List".
Command Button is querying the table Created_Submitted

If I select Cuckoos in the combo box I want to click the search button and have everything in the table the query hits with the title of Cuckoos returned.

Here is the code:
================================================== ==
Private Sub CmdSearchByTitle_Click()
On Error GoTo Err_CmdSearchByTitle_Click

Dim stDocName As String

stDocName = "Created_Submitted_Query"
If [Forms]![Records_Search]![CboTitleSearch] = [Created_Submitted].[Title] Then
DoCmd.OpenQuery stDocName, acNormal, acEdit
End If

Exit_CmdSearchByTitle_Click:
Exit Sub

Err_CmdSearchByTitle_Click:
MsgBox Err.Description
Resume Exit_CmdSearchByTitle_Click

End Sub
================================================== ==

I think that the more look at this the more confused my little brain gets. Any help would be greatly appreciated.

Thanks,
Doug
Mar 3 '08 #1
Share this Question
Share on Google+
4 Replies


P: 48
Sorry it should read Microsoft Access can't find the field "|" referred to in your expression". I had fine instead of find in the subject line.

Hello everyone,

I have created a search button but I receive the message "Microsoft Access can't fine the field "|" referred to in your expression" when I try to use it. I have looked online for this error but the fix did not pertain to this problem because the table or field name did not match any reservered Access words as described.

My records search form will have two combo boxes and one or two search buttons. I am just trying to get one to work before I even create the 2nd combo box.

What I want is the command button to run a query and return any records that match what is in the combo box.

For Example:
My combo box is named CboTitleSearch
My command button is named CmdSearchByTitle
Combo Box is selecting from the table "Titles List".
Command Button is querying the table Created_Submitted

If I select Cuckoos in the combo box I want to click the search button and have everything in the table the query hits with the title of Cuckoos returned.

Here is the code:
================================================== ==
Private Sub CmdSearchByTitle_Click()
On Error GoTo Err_CmdSearchByTitle_Click

Dim stDocName As String

stDocName = "Created_Submitted_Query"
If [Forms]![Records_Search]![CboTitleSearch] = [Created_Submitted].[Title] Then
DoCmd.OpenQuery stDocName, acNormal, acEdit
End If

Exit_CmdSearchByTitle_Click:
Exit Sub

Err_CmdSearchByTitle_Click:
MsgBox Err.Description
Resume Exit_CmdSearchByTitle_Click

End Sub
================================================== ==

I think that the more look at this the more confused my little brain gets. Any help would be greatly appreciated.

Thanks,
Doug
Mar 3 '08 #2

Denburt
Expert 100+
P: 1,356
The following line doesn't make any sense and could be throwing a curve to MS Access as well.

If [Forms]![Records_Search]![CboTitleSearch] = [Created_Submitted].[Title] Then


What the heck is [Created_Submitted].[Title] and where is it located?
Mar 3 '08 #3

P: 48
[Created_Submitted].[Title] is the table and field I am trying to compare the form field. I have another form that creates an append query. There will be multiple records for a certain title in this query. The append query is called Created_Submitted. On this otrher form I have a button to pull up the Records_Search form.

I have tried using Me![CboTitle Search] instead of [Forms]![Records_Search]![CboTitleSearch] but that gave me the same problem.

The following line doesn't make any sense and could be throwing a curve to MS Access as well.

If [Forms]![Records_Search]![CboTitleSearch] = [Created_Submitted].[Title] Then


What the heck is [Created_Submitted].[Title] and where is it located?
Mar 3 '08 #4

Denburt
Expert 100+
P: 1,356
[Created_Submitted].[Title] is the table and field I am trying to compare the form field. I have another form that creates an append query. There will be multiple records for a certain title in this query. The append query is called Created_Submitted. On this otrher form I have a button to pull up the Records_Search form.

I have tried using Me![CboTitle Search] instead of [Forms]![Records_Search]![CboTitleSearch] but that gave me the same problem.
Unless you have that table opened in another form you will need to open it or access it through code using dlookup("Title","Created_Submited","Title = " & [Forms]![Records_Search]![CboTitleSearch]) or an openrecordset utilizing what ever necessary criteria. although Dlookup can slow things down a bit it can be a handy function for accomplishing some tasks.
Mar 3 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.