Run-time error 3061

T

tecas

HELP convert an RPG programmer to the wonderful world of VBA!!!!
Why am I recieving the "Run-time error 3061. Too few parameters.
Expected 1" error.

Here is my code and i am recieving the message on the statement "Set
rst = db.OpenRecordset(strSQL)"


Private Sub Command20_Click()
Dim txtPartNo As String
Dim dblSA As Double
Dim dblTotSA As Double
Dim dblAmpHrs As Double
Dim intAnnodes As Integer
Dim dblAmps As Double
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String

txtPartNo = Me.cboPartNo.Value
strSQL = "SELECT * FROM tblPlatingSurfaceArea WHERE
((tblPlatingSurfaceAres.PartNumber) = '" & _
txtPartNo & "')"
Set db = CurrentDb()
Set rst = db.OpenRecordset(strSQL)
If Not rst.EOF Then
dblSA = rst.Fields("SurfaceArea").Value
dblTotSA = Val(Me.txtQty.Value) * dblSA
Me.txtAmpHours = 15 * dblTotSA * Val(Me.txtThickness.Value)
Me.txtAmps = 45 * dblTotSA
intAnnodes = (dblTotSA * 1.5)
Me.txtAnnodes = intAnnodes
Else
MsgBox ("Invalid Part # selected!! Try Again.")
End If
End Sub


Any help would be greatly appreciated.


Thanks,
Ted
 
T

tecas

HELP convert an RPG programmer to the wonderful world of VBA!!!!
Why am I recieving the "Run-time error 3061. Too few parameters.
Expected 1" error.

Here is my code and i am recieving the message on the statement "Set
rst = db.OpenRecordset(strSQL)"

Private Sub Command20_Click()
Dim txtPartNo As String
Dim dblSA As Double
Dim dblTotSA As Double
Dim dblAmpHrs As Double
Dim intAnnodes As Integer
Dim dblAmps As Double
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String

txtPartNo = Me.cboPartNo.Value
strSQL = "SELECT * FROM tblPlatingSurfaceArea WHERE
((tblPlatingSurfaceAres.PartNumber) = '" & _
txtPartNo & "')"
Set db = CurrentDb()
Set rst = db.OpenRecordset(strSQL)
If Not rst.EOF Then
dblSA = rst.Fields("SurfaceArea").Value
dblTotSA = Val(Me.txtQty.Value) * dblSA
Me.txtAmpHours = 15 * dblTotSA * Val(Me.txtThickness.Value)
Me.txtAmps = 45 * dblTotSA
intAnnodes = (dblTotSA * 1.5)
Me.txtAnnodes = intAnnodes
Else
MsgBox ("Invalid Part # selected!! Try Again.")
End If
End Sub

Any help would be greatly appreciated.

Thanks,
Ted

Nevermind, found the error, typo on the table name in the WHERE
clause.

Thanks for looking.
 
T

Tony Toews [MVP]

tecas said:
HELP convert an RPG programmer

RPG eh? AS/400 or whatever it's called these days?

Tony (worked in RPG II on IBM S/34 and S/36 and III on S/38 as AS/400)
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top