Thanks! Worked like a charm!
"Klatuu" wrote:
[Quoted Text] > The references to your form controls has to be outside the quotes: > > rs.Open "SELECT UPS_CSV_EXPORT.Track FROM UPS_CSV_EXPORT > WHERE (((UPS_CSV_EXPORT.order) = '" & [Forms]![EmailForm2]![order] & "') And > ((UPS_CSV_EXPORT.Track) <= '9') And ((UPS_CSV_EXPORT.PUDate) > #9/17/2006#)) > ORDER BY UPS_CSV_EXPORT.Track", CurrentProject.Connection, adOpenKeyset, > adLockOptimistic > > > The above assumes UPS_CSV_EXPORT.order is a text field. It it is a numeric > field then you would not include the single quotes: > > (UPS_CSV_EXPORT.order) = " & [Forms]![EmailForm2]![order] & ") And > > "DavidES" wrote: > > > I keep getting an error that says, "No value given for one or more required > > parameters" on the rs.Open line in the code below. The SQL for the query is > > copied from a query and works great. I cannot figure out the problem. > > > > This is a rewrite of some aircode I found on this discussion group. So the > > main problem is I am working with something I don't fully understand. Your > > help is greatly appreciated. > > > > Dim rs As New ADODB.Recordset > > rs.Open "SELECT UPS_CSV_EXPORT.Track FROM UPS_CSV_EXPORT > > WHERE (((UPS_CSV_EXPORT.order) = [Forms]![EmailForm2]![order]) And > > ((UPS_CSV_EXPORT.Track) <= '9') And ((UPS_CSV_EXPORT.PUDate) > #9/17/2006#)) > > ORDER BY UPS_CSV_EXPORT.Track", CurrentProject.Connection, adOpenKeyset, > > adLockOptimistic > > > > strEmail = "" > > > > Do While Not rs.EOF > > strEmail = strEmail & rs!Track & " ; " > > rs.MoveNext > > Loop > > > >
|