Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Method or Data Member Not Found"

Status
Not open for further replies.

pbrown2

Technical User
Jun 23, 2003
322
0
0
US
There is a field [CreatedBy] and currently it is filled in once an entry is made in the first field of the form. This code is being used in another form and it works. However, on this form and another, I keep getting a compile error of "Method or Data Member Not Found". Debug goes directly to [CreatedBy].Locked = False
All I am tring to say is that once the first field is filled in the CreatedBy and CreatedDate should fill in and then be locked so that if someone goes in and changes the first field, the creation data will stay the same. There are a ModifiedBy and ModifiedDate that keeps track of last time changed. Any suggestions???



Private Sub Text72_AfterUpdate()
' Once again to lock the "created by" and "when" fields

If IsNull(Me![CreatedBy]) Then
[CreatedBy].Locked = False
Else
[CreatedBy].Locked = True
End If

End Sub

Thank you for any and all help,

PBrown
 
Hi!

The errormessage often pops up when you've misspelled a FIELD name from a query/table (here, I belive interpreted as the undelying recordsource)

Some "naming standards":
Fields are located in tables, available thru queries and are present as part of the forms recordsource
The "thingies" on a form, are controls (textcontrols, combocontrols etc)

You are trying to lock a control on a form, now:

1 make sure the name of the control is actually CreatedBy (properties | other tab)
2 if you have a FIELD called CreatedBy in the forms recordsource and a CONTROL called CreatedBy on the form, Access sometimes confuses the two - change the names of the controls you are going to manipulate (if this is a textcontrol - txtCreatedBy... then changing it also in the code afterwards)
3 you might consider using a bit more complete references everywhere you refer to controls on the form: me!createdby (or better, after changing the name me!txtCreatedBy...)

Hope this is something to get you going.

Roy-Vidar
 
Normally i have found that error is associated with either a control name that is spelt wrong or doesnt exist, or a field that doesnt exist in the forms record source,or sometimes the code preceding the error has a control name spelt wrong.
Maybe That may be the problem
 
Thank you both for the hints. I do not know why on the first it works as [CreatedBy] but on the other forms I had to use Text72.locked = false

Once again, thanks for the tip.

PBrown
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top