G
Guest
The following code generates a syntax error on the RecordSet.Open command.
In looking at a number of examples it appears to me as if I'm apllying the
syntax properly (please note thea the sql string is word wrapped here, but
not in my app). What am I doing wrong here?
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,myConnection,adOpenStatic)
myRecordSet.MoveFirst
Me!UPrice = myRecordSet.Fields("UnitPrice")
myRecordSet.Close
Set myRecordSet = Nothing
Set myConnection = Nothing
End Sub
In looking at a number of examples it appears to me as if I'm apllying the
syntax properly (please note thea the sql string is word wrapped here, but
not in my app). What am I doing wrong here?
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,myConnection,adOpenStatic)
myRecordSet.MoveFirst
Me!UPrice = myRecordSet.Fields("UnitPrice")
myRecordSet.Close
Set myRecordSet = Nothing
Set myConnection = Nothing
End Sub