Run time error

G

Guest

I am receiving run time error '3251' with the message: "Operation is not
supported for this type of object" at line 7 (rcdOrders.FindFirst
"rcdOrders![....) during execution of the following code:

Private Sub MarginForProduction_AfterUpdate()
Dim db3 As DAO.Database
Dim rcdOrders As DAO.Recordset
Dim NumberOfDates As Double
Set db3 = CurrentDb
Set rcdOrders = db3.OpenRecordset("tblOrders", dbOpenTable)
' PONumber is text
rcdOrders.FindFirst "rcdOrders![PONumber] = '" & Me![PONumber] & "'"
If Not rcdOrders.NoMatch Then
rcdOrders.Edit
NumberOfDates = rcdOrders![DateMaterialsOrder] +
rcdOrders![MarginForProduction] + rcdOrders![ProductionTime]
rcdOrders![StartDateProd] = DateAdd("d", -NumberOfDates, Me![PromisedDate])
rcdOrders.Update
End If
End Sub

Where is my mistake?
Your help is appreciated !
 
G

Guest

Thanks for your help.
Unfortunately it doesn't work with your suggestion.
When I use the same code and open a query (instead of tblOrders) that
generates the appropriate fields for this form it works.
Is this command not supported for Tables?

Damian S said:
Hi Joseph,

Try:

rcdOrders.FindFirst "[PONumber] = '" & Me![PONumber] & "'"

Damian.


Joseph said:
I am receiving run time error '3251' with the message: "Operation is not
supported for this type of object" at line 7 (rcdOrders.FindFirst
"rcdOrders![....) during execution of the following code:

Private Sub MarginForProduction_AfterUpdate()
Dim db3 As DAO.Database
Dim rcdOrders As DAO.Recordset
Dim NumberOfDates As Double
Set db3 = CurrentDb
Set rcdOrders = db3.OpenRecordset("tblOrders", dbOpenTable)
' PONumber is text
rcdOrders.FindFirst "rcdOrders![PONumber] = '" & Me![PONumber] & "'"
If Not rcdOrders.NoMatch Then
rcdOrders.Edit
NumberOfDates = rcdOrders![DateMaterialsOrder] +
rcdOrders![MarginForProduction] + rcdOrders![ProductionTime]
rcdOrders![StartDateProd] = DateAdd("d", -NumberOfDates, Me![PromisedDate])
rcdOrders.Update
End If
End Sub

Where is my mistake?
Your help is appreciated !
 

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

Similar Threads


Top