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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get result of query into variable in code of a button 1

Status
Not open for further replies.

Frank72

Technical User
Nov 13, 2001
57
IE
Hows it going?

I have a 1 field query that gives the maxdate of another query i want to use this date to ensure a later date is not entered into a text box.
here is the code:

If txtDateUpTo <= MaxDate Then
MsgBox &quot;Please enter a date after &quot; & MaxDate & vbCrLf & &quot;Please refer to Previous Reports&quot;, vbOKOnly, &quot;Date already batched&quot;
Exit Sub
End If


any idea how to get this date into variable, i've tried to use a textbox with th query as a recordsource but it wouldn't go in.

thanks alot

frank
 
Hi Frank!

Try setting the control source of the textbox(or your variable) to:

= DMax(&quot;YourDateField&quot;, &quot;YourQuery&quot;)

hth
Jeff Bridgham
bridgham@purdue.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top