Query by text box in a form errors (1 Viewer)

TheSafetyGuy86

Registered User.
Local time
Today, 18:45
Joined
Jun 18, 2013
Messages
31
I have a table that stores the criteria that the query is supposed to pull from so that when a user logs into my database, it reads that the person is part of a sepcific unit and then pulls that specific criteria and places it in a text box on a form. When they click a button on that form, it then opens the form that is connected to the query. The data type for the field I need criteria for is a number, so the criteria that shows up in the text box is this "1 or 3 or 5" so that it shows those specific numbers. If i put that directly into the query, it works just fine, but if I try to connect it from the text box in the form, it gives me a "data mismatch error" or an error explaining that criteria is too vast for access to pull the information. How do I make it read the information in there so that I dont have to create 1000 forms for each different unit.

Example:

Field: Unit
Table: Master Log Data
Criteria: 1 or 2 or 3

Works fine!


Field: Unit
Table: Master Log Data
Criteria: [Forms]![Selector]![Criteria]

The text box that is referenced in the criteria in the query says 1 or 2 or 3 and then I get an error... If the information is the same, why does it work when I place it in the query specifically, but not when its in the text box?

Lee
 

pr2-eugin

Super Moderator
Local time
Today, 23:45
Joined
Nov 30, 2011
Messages
8,494
Unfortunately Inbuilt queirs do not work like that.. What you can do is change the Recordsource of the Form in Runtime.. Use the Form Open event, to set the Recordsource..
 

Users who are viewing this thread

Top Bottom