Paul,
I've been away; hense no earlier response to your prior questions. Here are a couple of pointers which I think will help:
(a) Instead of building the variables into the query, using the [Enter Start Id Number] type syntax, use a form to prompt for your variables.
(b) Then when you build the SQL, you take the values of these form based controls and plant them directly into the sql you are building.
(c) Here's an example. I'm assuming that you have a form frmYourForm, and it has two text controls and a button. The text controls are called StartIdFrom and StartIdTo respectively, and the button is called btnRunReport. When clicked, the button opens a report called rptYourReport.
(d) When the form is opened, you simply enter the start and end id numbers into the corresponding controls.
(e) The code behind the Click event of the button is simply to open the rptYourReport report; ie.
Code:
docmd.OpenReport rptYourReport ,acViewPreview
(f) The SQL gets built by the report itself during its OnOpen event; you'd have code something like this:
Code:
sq = "Select Main.FirstName, Main.M, Main.LastName, " & _
" ID.IDNum, ID.Date, etc, etc, etc " & _
"From Client INNER JOIN ID " *& _
"on MAIN.Socail = ID.Socail " & _
"WHERE ID.IDNum Between " Forms!frmYourForm!StartIdFrom & " " & _
"AND " & Forms!frmYourForm!StartIdTo & " "
I guess the trick with all of this stuff is to understand the string concatenation which is occuring to construct the entire sql clause; also to recognise how the values of the form controls are being incorporated into the sql.
Hope this clarifies things a bit.
Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
(dont cut corners or you'll go round in circles)