Solved Problem with search and filter (1 Viewer)

maabadi

New member
Local time
Today, 19:25
Joined
Aug 6, 2012
Messages
14
Hi.
I create form to search my database and filter it based Keywords. But when I want to use it , it shows #name Error (Step 3) ( but when I want to see print preview no error (Step 5)).
I don't know why.
Please if it is possible Check my file and tell what is wrong.
11.jpg
13.jpg
12.jpg
 

Attachments

  • FixingWellsLast.accdb
    2.3 MB · Views: 64

CJ_London

Super Moderator
Staff member
Local time
Today, 15:55
Joined
Feb 19, 2013
Messages
16,614
'FieldName' is a reserved word and should not be used a a field name. Change to fldName
 

maabadi

New member
Local time
Today, 19:25
Joined
Aug 6, 2012
Messages
14
Thanks @CJ_London for fast replying.
'FieldName' at where I should Change. At CenterFixingF or FixCenterQ or ...?
if it is possible show with image. thanks.
 

maabadi

New member
Local time
Today, 19:25
Joined
Aug 6, 2012
Messages
14
Thanks @MajP , but I don't use Field and Fields, I use FieldName then I think this is not my problem and also I use the same method for second section and it works.
Thanks @bob fitz . I think this is my problem. But I don't know how to solve it. I create a query with data from both table to have fieldname name and fieldname id, but still I have problem.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 15:55
Joined
Feb 19, 2013
Messages
16,614
'FieldName' at where I should Change.
in the form recordsource
1695219691312.png


It may be that 'fieldname' is not a reserved word, but the list provided by MS is not exhaustive. It may be it is reserved in a different language or there is some other factor in play
 

Attachments

  • 1695219574804.png
    1695219574804.png
    5.4 KB · Views: 48

maabadi

New member
Local time
Today, 19:25
Joined
Aug 6, 2012
Messages
14
Thanks again @CJ_London . I check again , Change name, Delete form and Create it again but again I see same error.
But what Surprise me is when I enter FieldName at search box, it works and filter database and I see correct result at Report section but at this form I cann't see it and show #name Error.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 15:55
Joined
Feb 19, 2013
Messages
16,614
All I can is it worked for me - not even sure why you are aliasing the field anyway.
 

maabadi

New member
Local time
Today, 19:25
Joined
Aug 6, 2012
Messages
14
I want to give it to another person and he want to see field names. I also surprise why I don't have same problem at Well section and Forms but when I use Center section I see this Problem.
if Center section work for you without problem and if it's possible please upload file here.
Thhanks.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 15:55
Joined
Feb 19, 2013
Messages
16,614
see attached.

I've dug a bit deeper. Your problem is that 'fieldName' is the (poorly named) name of a field in another table and further it is a number datatype and in the case of CentreT, it is a lookup field. Strongly recommend you don't use lookups in table. You see text, so you give it a text type name whereas the actual value is a numeric ID

But you have also brought through the numeric fieldname field from CentreFixingT.

1695246554511.png


if you open the query you will see so there are two fieldnames - a text (now called fldName) and the number field

1695246354343.png


I renamed the field, but you could remove the CentreFixingT.* and replace with the fields actually required. Again using .* is generally poor practice unless you actually want all the fields. Chances are you don't actually want the fieldname field in CentreFixingT
 

Attachments

  • image_2023-09-20_223738802.png
    image_2023-09-20_223738802.png
    11.1 KB · Views: 48
  • FixingWellsLast.accdb
    2.4 MB · Views: 56

CJ_London

Super Moderator
Staff member
Local time
Today, 15:55
Joined
Feb 19, 2013
Messages
16,614
I suggest rename fieldnm to fieldname and the fieldname fields in the other tables to fieldID or similar
 

Users who are viewing this thread

Top Bottom