?
Solved

Using VB 5.0 to add Foxpro 2.6 records

Posted on 1998-06-12
1
Medium Priority
?
143 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 5

Accepted Solution

by:
bin_huwairib earned 300 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…
Suggested Courses

765 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