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

Need help with SQL-VBA concatenation...

Status
Not open for further replies.

Goot

Programmer
Aug 4, 2005
86
US
I am having a little trouble with the concatenaton
I want to concatenate the ID and the document name for lookup...


sSQL = "Select * from [issues] Where ID " & Me.txtLinkID.Value & " And " & "DocumentName = '" & Me.txtDocument & "'"


How should this read?
Thanx
 
I would think an equal sign after ID?

[tt]sSQL = "Select * from [issues] Where ID = " & Me.txtLinkID.Value & " And DocumentName = '" & Me.txtDocument & "'"[/tt]

- assuming ID is numeric and DocumentName is text.

Roy-Vidar
 
Nope,,,getting too few parameters...expected 1

I hate this!
 
Then round up the usual suspects, starting with

* typo in criteria field name <- my guess
* are there valid values in both controls
* what datatypes are the fields
* how does the string look (do a debug.print sSQL, then hit ctrl+g to study)
* how do you run it

And please, do have a look at for instance faq181-2886, perhaps in perticular #14 ...

Roy-Vidar
 
Provided tha the table 'issues' has a numeric field named 'ID' and a text field named 'DocumentName':
sSQL = "SELECT * FROM [issues] WHERE ID=" & Me!txtLinkID & " AND DocumentName=[tt]'"[/tt] & Replace(Me!txtDocument,[tt] "'", "''") & "'"[/tt]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Still getting too few parameters...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top