GaelicFatboy
Registered User.
- Local time
- Today, 21:02
- Joined
- Apr 17, 2007
- Messages
- 100
Ladies & Gents,
Once again I'm here knowing exactly how I need to structure my software to run, but I'm at a complete loss as to what the correct syntax should be.
I've got a query called My_Query with three fields namely PartNumber, AccountNumber and Discount. I've got some code to look at this query and update the Discount field for a given account number, but I am unable to code the filter on the query with regards to the account number. My code is as follows:
Dim My_DataBase as DAO.Database
Dim My_RecordSet as DAO.RecordSet
Dim My_QueryDef as QueryDef
Set My_DataBase = CurrentDb
Set My_QueryDef = My_DataBase.QueryDefs("My_Query")
My_QueryDef.Parameters("AccountNumber") = 777 'this is the line that causes the error
Set My_RedordSet = My_DataBase.OpenRecordSet("My_Query",dbOpenDynaset)
My_RecordSet.FindFirst "PartNumber=""" & Me.Text_PartNumber & """"
If Not .NoMatch Then
.Edit
![Discount] = Me.Text_Discount
.Update
.Close
End If
End With
Question do I need to Dim any more variables?
Cheers
D
Once again I'm here knowing exactly how I need to structure my software to run, but I'm at a complete loss as to what the correct syntax should be.
I've got a query called My_Query with three fields namely PartNumber, AccountNumber and Discount. I've got some code to look at this query and update the Discount field for a given account number, but I am unable to code the filter on the query with regards to the account number. My code is as follows:
Dim My_DataBase as DAO.Database
Dim My_RecordSet as DAO.RecordSet
Dim My_QueryDef as QueryDef
Set My_DataBase = CurrentDb
Set My_QueryDef = My_DataBase.QueryDefs("My_Query")
My_QueryDef.Parameters("AccountNumber") = 777 'this is the line that causes the error
Set My_RedordSet = My_DataBase.OpenRecordSet("My_Query",dbOpenDynaset)
My_RecordSet.FindFirst "PartNumber=""" & Me.Text_PartNumber & """"
If Not .NoMatch Then
.Edit
![Discount] = Me.Text_Discount
.Update
.Close
End If
End With
Question do I need to Dim any more variables?
Cheers
D