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

Connect Queries to Textboxes within an MS Access form

Status
Not open for further replies.

OwenHall

Technical User
Jul 23, 2002
21
GB
Sounds crazy, but I just can not get an SQL query that I been working on, to link to a text box on one of my forms.

I'm creating a Machine Processing Database which monitors production of long periods. So what I created was a "start date" and "end date" query to say, Less than "End" and Greater than "Start". But I just can't get it to link to my text boxes.

Can anyone help me?
 
Assuming you want to open another form which is then filtered to only show records for which one field matches the date criteria you set on your search form:

Have a Search button on your form. In it's onClick event, write some code like this:

Sub cmdSearch()
Dim strSQL As String

strSQL = "MyDateField BETWEEN #" _
& Me!txtStartDate _
& "# AND #"
& Me!txtEndDate _
& "#"

DoCmd.OpenForm("myFormName",,,strSQL)

End Sub

I haven't tested this, so you may have to play about with it, but at least it should give you the right idea.

HTH,
Burns
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top