Me.NewRecord

joeatact

Registered User.
Local time
Today, 20:28
Joined
Jun 6, 2003
Messages
11
Have this one error that just started with this code :

If Me.NewRecord then
On Error Resume Next
Me.quoteNo = Nz(DMax("[quoteNo]","tblACTmain"), 0) + 1

End If

I get the error Method or data member not found the Me.quoteNo = is highlighted.

This did work at one time. Did I change something somewhere. Oh if I use ! instead of the . between the Me and quoteNo it seems to work.

Joe
 
What is quoteNo in your form? Is it the name of a field? Any chance it is also the name of a field in your underlying table/query (if the form is bound)?
 
dcx693 said:
What is quoteNo in your form? Is it the name of a field? Any chance it is also the name of a field in your underlying table/query (if the form is bound)?

It is a number field in my table. It is also a field in query. Is there a workaroung?

Joe
 
If the Me!quoteNo is working, then just use that. It should be equivalent to writing Me.Controls("quoteNo"). Or try renaming your form field to txtquoteNo. Lots of VB developers preprend form controlnames with their field type ("txt" for text field, "cbo" for combo boxes, "lst" for list boxes, etc...) to differentiate them from the query fields and to make it obvious what type of control it is when viewing code.

In general, try not to have any form controls named the same as fields in your query. It gets confusing and might be causing your issue now.
 

Users who are viewing this thread

Back
Top Bottom