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
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