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

Simple SQL Statement in VB

Status
Not open for further replies.

mans

Programmer
Mar 18, 2000
136
AU
Hello,<br><br>I am attemtping to execute the following SQL statement from within VB6 to an Access2000 database, the statement works fine from within Access itself but when I run it in VB it says there are too many arguments etc.&nbsp;&nbsp;I have identified the problem as being the concatenation part of the statement, can somebody please let me know what I need to do to the statement below to allow it to run from within VB.<br><br>daoDB36.Execute &quot;SELECT (Test.Surname+&quot;, &quot;+Test.FirstName) As Name FROM Test&quot;<br><br>Please ignore any VB code protocol such as new line identifiers etc, that is all OK, the focus should only be on the select statement itself.<br><br>Thank you
 
I am assuming that the information in the database is written as such:&nbsp;&nbsp;Smith, John<br><br>try this:<br><br>daoDB36.Execute &quot;SELECT (Test.Surname&quot; & &quot;, &quot; & &quot;Test.FirstName) As Name FROM Test&quot;<br><br>
 
If Test is your form name????<br><br>Dim SQL As String<br>SQL = &quot;SELECT Name As FROM Test Where Name = &quot; & Test.Surname & &quot;, &quot; & Test.FirstName<br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top