how to specify parameters in sql statement?

zambam

Registered User.
Local time
Today, 04:02
Joined
Mar 19, 2006
Messages
39
hi,

i have written an sql statement to display fields from a table. but i want it to do this based on a date range (the user enters a parameter)

this can happen in access, but im using vb6 to do this and i dont know how to specify the parameter to wait for user input to filter the results

pls help
 
hi,

i have written an sql statement to display fields from a table. but i want it to do this based on a date range (the user enters a parameter)

this can happen in access, but im using vb6 to do this and i dont know how to specify the parameter to wait for user input to filter the results

pls help

The best way is to have the user select the date/dates on a form and reference the form's controls.
 
thanks, but how would i do that? im using vb6

thanks
 
Sorry, I missed that one. I'll have to defer to someone else as I haven't done a lot with what you're needing in VB6.
 
I don't remember, does access have the date/time picker control?

The trick will be getting the users to enter data in date/time format.

I say have 2 textboxes (maybe put a date/time mask on them) and a button, user puts in the start/end of the range and presses the button. You build the string like

"select blah blah from blah blah where start = ' " & startTextbox & " ' and finish = ' " & endTextbox & " ' "

set the query equal to the string and then run the query.

I'll have an actual code example when I get into work tommorow.
 
I don't remember, does access have the date/time picker control?

The trick will be getting the users to enter data in date/time format.

I say have 2 textboxes (maybe put a date/time mask on them) and a button, user puts in the start/end of the range and presses the button. You build the string like

"select blah blah from blah blah where start = ' " & startTextbox & " ' and finish = ' " & endTextbox & " ' "

set the query equal to the string and then run the query.

I'll have an actual code example when I get into work tommorow.

thanks pls do, id really appreciate that.

in the meantime ill try figure it out from what you have said.
 
this is an example of one of the things i have:

SELECT `Member ID`, Forename, Surname, `Date Loaned`
FROM Loans

i want the user to specify a date range so all the loans between that date range are shown. in access, to enter a parameter as all of you already know it would be between[start date] and [end date]. but in vb6 sql builder, i cant use this as a parameter.
 

Users who are viewing this thread

Back
Top Bottom