Solved

Using VB 5.0 to add Foxpro 2.6 records

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…

749 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