Compile Error: Method or data member not found

  • Thread starter P-chu via AccessMonster.com
  • Start date
P

P-chu via AccessMonster.com

Can someone please look through this code and detemine why my last entry is
not working?

If ([Device Type] = "PC") Or ([Device Type] = "SERVER") Or ([Device Type] =
"LAPTOP") Then
Me![Machine Name].Visible = True
Me![Processor].Visible = True
Me![RAM].Visible = True
Me![OS].Visible = True
Me![Service Pack].Visible = True
Me![HD Size].Visible = True
Me![Mac Address].Visible = True
Me![IP Address].Visible = True
Me![IP Address Suffix].Visible = True
Me![OEM product key].Visible = True
Me![Domain].Visible = True (debug stops on this one every time)

Else
Me![Machine Name].Visible = False
Me![Processor].Visible = False
Me![RAM].Visible = False
Me![OS].Visible = False
Me![Service Pack].Visible = False
Me![HD Size].Visible = False
Me![Mac Address].Visible = False
Me![IP Address].Visible = False
Me![IP Address Suffix].Visible = False
Me![OEM product key].Visible = False
Me![Domain].Visible = False (debug also stops on this one everytime)


End If


End Sub


Thanks for any assistance.
 
A

Allen Browne

Sounds like you have a field named Domain in the form's RecordSource, but
the text box is named something else. You can hide a control, but you can't
hide an AccessField.

To verify if that's the problem, as Access what type of object it is. Open
the Immediate Window (Ctrl+G), and enter an expression like this:
? TypeName(Forms![Form1]![Domain])

If that's not the case, Domain is a reserved word so Access may be confused
about that. Change the text box name to (say) txtDomain, and change the code
to:
Me.txtDomain.Visible = ...

In general it's best to avoid reserved words as field names. There's quite a
lot, so here's a list to refer to when designing your tables:
http://allenbrowne.com/AppIssueBadWord.html
 
P

P-chu via AccessMonster.com

Thank you so much, this fixed the whole problem. Changing the name from
Domain to something else.

Allen said:
Sounds like you have a field named Domain in the form's RecordSource, but
the text box is named something else. You can hide a control, but you can't
hide an AccessField.

To verify if that's the problem, as Access what type of object it is. Open
the Immediate Window (Ctrl+G), and enter an expression like this:
? TypeName(Forms![Form1]![Domain])

If that's not the case, Domain is a reserved word so Access may be confused
about that. Change the text box name to (say) txtDomain, and change the code
to:
Me.txtDomain.Visible = ...

In general it's best to avoid reserved words as field names. There's quite a
lot, so here's a list to refer to when designing your tables:
http://allenbrowne.com/AppIssueBadWord.html
Can someone please look through this code and detemine why my last entry
is
[quoted text clipped - 33 lines]
Thanks for any assistance.
 

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

Top