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

DoCmd.RunSQL "INSERT INTO

Status
Not open for further replies.

Shannon88

Technical User
Mar 4, 2003
17
0
0
US
In a form I have created a command button with the following code:

DoCmd.RunSQL "INSERT INTO TblIncentiveDetail (VenNumber,VendorName,IncentiveDescript,Criteria,GrowthIncent,DetailYear,IncentiveTotal) VALUES (VenNumber,VendorName,IncentiveDescript,Criteria,GrowthIncent,DetailYear,IncentiveTotal);"

The problem is that on some records it works great and on others it says "Invalid Arugment". I narrowed it down to the filed GrowthIncent. When I take it out of my code it works perfect. When I add GrowthIncent it doesn't work all the time. GrowthIncent is a memo field that holds text and numbers. Here is example:

10 - 14% Growth = .25% Rebate
15 - 19.00% Growth = 1% Rebate
20% + = 1.25% Rebate
Excludes 3M, BD, J&J, Drop Ships, Non-Stocks

Some similar text will go through but some won't. I don't even know what to check anymore.

Any help would be great!

Shannon
 
Docmd.RunSQL is limited to 255 caracters. See this post :
thread705-604014
 
Is the rule with 255 characters apply to the code characters or what the code is transferring?

I tried the CurrentProject.Connection.Execute 'SQLstring' as you recommended and the I get the error "Argument not optional".

Shannon
 
I've done similar "INSERTS" but I dont use the docmd...
with DAO
set db=currentdb()
db.execute "INSERT ...."

with ADO
set conn=server.createobject("ADODB.Connection")
conn.execute "INSERT ..."

also, and this is untested advice, use the word SELECT instead of VALUES.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top