Solved

Using VB 5.0 to add Foxpro 2.6 records

Posted on 1998-06-12
1
139 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…

829 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