Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bring a value from a txt box in a form into my query 1

Status
Not open for further replies.

VBAguy22

IS-IT--Management
Aug 5, 2003
180
CA
Hi,
I have a form in Access, say myForm, that has a txt box in it, say myDate (cut off date for some client activity).
I would like to bring the value of the txt box above (the value will change every time the user enters a new one) into my query. All I want is that value to appear on every line in a new field I created called CutOffDt.

In query design view I went to Build, then specified what form I wanted, selected the proper txt box and then <<Value>>, but for some reason when I have the form open and enter a value into the txt box, then load the query, that field comes up blank.

Any suggestions?
 
Is myForm a main form ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
erm, can you post your sql?

the format of the sql should be

select blah, blah, forms![frmNme]![tbxNme] as cutoffdt, blah...

--------------------
Procrastinate Now!
 
CutOffDt: [Forms]![Main Form]![CutOff]

And yes, it is the main form. I don't have any secondary/pop up forms in the system.
 
Ok I found the reason.
It was because the txt box was formatted to accept Date values. For some reason, when I removed the format filter, everything worked. But now I have to worry about the user screwing the input up :(
 
it would be better to set up the value you are testing against to be date/time

--------------------
Procrastinate Now!
 
In the SQL view pane of the query window:
PARAMETERS [Forms]![Main Form]![CutOff] DateTime;
SELECT ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top