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!

Errors with SQL statments in VB

Status
Not open for further replies.

LeahLady79

Programmer
Jan 27, 2003
9
US
Hello all...

Here is my problem. I am trying to gather specific information from fields in my Paradox tables. When I execute the SQL statements in Access, they work beautifully... but when I copy them over to VB 6 I am getting:

"too few parameters" error when I try to put it as the RecordSource for the adodc

"expected SELECT, INSERT, DELETE.." when I try to put it in the actual code as an SQL string.

Here is the SQL statement I am running:

SELECT UserInfo.Rep_Name, ADCAL.ADVERTIZER, ADCAL.DESC
FROM ADCAL, UserInfo
WHERE ((([ADCAL]![NAME]) Like [UserInfo]![User_name] & "*"));

ALSO, I need to run an insert/delete to populate a table each time the program runs. I am getting an "expected more parameters" error for this statement as well:

INSERT INTO Holding ( [Key], Name )
SELECT [ADCAL].[Name], [Rep_Name]
FROM ADCAL, UserInfo
WHERE (([ADCAL]![NAME] Like [UserInfo]![User_name] & "*"));


Any ideas where I'm going wrong? Why would these statements work in Access but not in VB??

Thank you!!
 
First of all remeber that paradox is not a microsoft product so what works in MS Access may not necessarily work in Paradox. I would assume it won't work. A couple of things to look into.

1. Double check what the wild card character is for paradox. '*' may not be it. For example '%' is the character for MS SQL server.

2. Check the syntax of your insert SQL statment needed for paradox. The syntax for MS can be found in thread709-462411.

Thanks and Good Luck!

zemp
 

This may be your problem:

WHERE ((([ADCAL]![NAME]) Like [UserInfo]![User_name] & "*"));

Change it to:
WHERE ((([ADCAL].[NAME]) Like [UserInfo].[User_name] & "*"))

See what happens when you change the exclamation marks to dots.


[/b][/i][/u][sub]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top