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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

refer to a field coming up #error

Status
Not open for further replies.

GirlBlonde

Programmer
Oct 30, 2007
94
AU
Hi

i have programed in that whoever the user is for the machine is tracked in a field on the form. so if joe smith is logged on a field says joe smith. should someone log into the form that is not within the registered user table of course it appears as #error.

what i need to do is put an on open message in the form so that if the field is #error i will make a message appear and they have to then follow certain procedures to add new user.

so my long winded question is how do i refer to a field that populates with #error. i tried

if me.user.value = #error and nothing works.

greatly appreciate any assistance.

Energy & persistance conquer all things!
 
How are ya GirlBlonde . . .

If [blue]#Error[/blue] is generated by a [blue]controlsource[/blue] equation like:
Code:
[blue]= YourEquation[/blue]
then there isn't much you can do. [sad] Its possible ... depending on the equation you provide!

Alternately, if [blue]#Error[/blue] is generated by a VBA assignment like:
Code:
[blue]   Me!TextboxName = ResultOfYourCode[/blue]
then you can set error trapping to do what you want!

The path to take depends on the code you provide! [surprise]

[blue]Your Thoughts . . .[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
hi aceman

i had a feeling it was not going to be simple. i am stumped on this one. is there a way then that i can put a code on the button that opens the form in question and if it looks up in the user table and finds the user trying to access the form is not in there then make them go to a form to add if nec?

i hope i am making sense. i am trying to limit the use of the form to only scheduled staff authorised to change data.

many thanks

Energy & persistance conquer all things!
 
G'day

Yes, creating a button is too easy, but as Aceman says we need to know exactly how you're getting your "user" eg, joe smith. From that we can show you how to bypass the #error and abort the form opening :)
 
... and if it looks up in the user table and finds the user trying to access the form is not in there ...

You can DlookUp the user table.

[tt]If IsNull(DlookUp("User","tblUsers","User='" & Me.txtUser & "'")) Then[/tt]
 
hi everyone

solved the problem. on the form open button i did a lookup of the user number and if it is null i prompted them to add.

thanks for all your imput.

Energy & persistance conquer all things!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top