Solved

Using VB 5.0 to add Foxpro 2.6 records

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

691 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