G
Guest
I'm using ACCESS 2003, ADO Data Objects library 2.8.
I am receiving a syntax error at runtime on the RecordSet.Open command. The
error is: "No value given for one or more required parameters". Obviously I
have something coded wrong, but I sure can't see the problem.
My code is (note: the SQL statement is not word wrapped in my module):
Private Sub PType_AfterUpdate()
Dim myConnection As ADODB.Connection
Dim myRecordSet As New ADODB.Recordset
Dim mySQL As String
Set myConnection = CurrentProject.Connection
myRecordSet.ActiveConnection = myConnection
mySQL = "SELECT [Product Types].UnitPrice FROM [Product Types] WHERE
((([Product Types].VendorName)=[Vendor]) AND (([Product
Types].Name)=[Product]) AND (([Product Types].Type)=[PType]))"
myRecordSet.Open mySQL, , adOpenStatic
myRecordSet.MoveFirst
Me!UPrice = myRecordSet.Fields("UnitPrice")
myRecordSet.Close
Set myRecordSet = Nothing
Set myConnection = Nothing
End Sub
I am receiving a syntax error at runtime on the RecordSet.Open command. The
error is: "No value given for one or more required parameters". Obviously I
have something coded wrong, but I sure can't see the problem.
My code is (note: the SQL statement is not word wrapped in my module):
Private Sub PType_AfterUpdate()
Dim myConnection As ADODB.Connection
Dim myRecordSet As New ADODB.Recordset
Dim mySQL As String
Set myConnection = CurrentProject.Connection
myRecordSet.ActiveConnection = myConnection
mySQL = "SELECT [Product Types].UnitPrice FROM [Product Types] WHERE
((([Product Types].VendorName)=[Vendor]) AND (([Product
Types].Name)=[Product]) AND (([Product Types].Type)=[PType]))"
myRecordSet.Open mySQL, , adOpenStatic
myRecordSet.MoveFirst
Me!UPrice = myRecordSet.Fields("UnitPrice")
myRecordSet.Close
Set myRecordSet = Nothing
Set myConnection = Nothing
End Sub