Computing.Net > Forums > Programming > vb6 and sql language

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

vb6 and sql language

Reply to Message Icon

Name: VBIDIOT
Date: September 18, 2002 at 11:12:39 Pacific
OS: 98
CPU/Ram: 350/196
Comment:

I have a sql query that limits records displayed on a form and it works great. it looks something like this
dim inp as string
inp=InputBox("ENTER NAME")
data1.recordsource = "select store.date, store.name form store where name="& inp
I have added another input variable and now it won't work. I'm sure it is in the sql statement. this is what I have now...
Dim inp as string
dim inp2 as string
inp=Inputbox("ENTER NAME")
inp2=InputBox("ENTER DATE")
Data1.recordsource = "Select store.name, store.date where name =" & inp AND date =" & inp2. this just doesn't seem to work.???



Sponsored Link
Ads by Google

Response Number 1
Name: madman
Date: September 18, 2002 at 16:33:23 Pacific
Reply:

It need to look this this.."Select store.name, store.date Where name = " & inp & " And date = #" & inp2 & "#". The whole statement must be a string when complete.


0

Response Number 2
Name: Steel
Date: September 19, 2002 at 00:05:59 Pacific
Reply:

The problem is, that you don't use the Hexens. This gives a problem with dates. Further if you want to execute a query like this you have to be certain that the date you send is in english format mm-dd-yyyy. Use the following statement:

"Select store.name, store.date Where name = '" & inp & "' And date = #" & format(inp2, "mm-dd-yyyy") & "#". And it will always work.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: vb6 and sql language

VB6 and SQL www.computing.net/answers/programming/vb6-and-sql/18229.html

VB and SQL www.computing.net/answers/programming/vb-and-sql/8034.html

VB6 and syntax for inner join with a subquery www.computing.net/answers/programming/vb6-and-syntax-for-inner-join-with-a-subquery/19728.html