Solved

Using VB 5.0 to add Foxpro 2.6 records

Posted on 1998-06-12
1
136 Views
Last Modified: 2010-05-03
dbs.Execute "INSERT INTO Paulson " _
   & "(Pnum,Hcode,Des,Ven,Cost,Lstprc,Price,....) VALUES " _
   & "(inPnum,inHcode,inDes,inVen,inCost,.......);"

produces     Run-time error '3061'
             Too few parameters. Expected 12.

Pnum is one of 12 valid fields defined on the existing Foxpro 2.6 database. This code follows my deletion of all records in the Foxpro database - the database is still open.
 
inPnum is one of 12 valid variables each containing valid data.

Any ideas?

0
Comment
Question by:DFC
1 Comment
 
LVL 5

Accepted Solution

by:
bin_huwairib earned 100 total points
ID: 1463218
DFC,

You must concatenate the variables with the string instead of including their names.

Example
========
dbs.Execute "INSERT INTO Paulson " _
       & "(Pnum,Hcode,Des,Ven,Cost,Lstprc,Price,....) VALUES _
       "(" & inPnum & "," & inHcode & "," & inDes & "," & inVen & "," & inCost & ","....... & ");"

And incase of using string variable you have to include the string in this format "'" & strName & "'"
Example
=======
dbs.Execute "INSERT INTO Paulson " _
       & "(Pnum,Name,....) VALUES _
       "(" & inPnum & ",'" & strName & "'," ....... & ");"


Best regards
Bin Huwairib
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now