user name and location

P

p-rat

I have a data entry form that is called from a switchboard. One of the
selections on the switchboard is 'Enter in Work Ticket'. When clicked
I would like to have a box pop up to ask "What is your location". The
user would then type in a location such as Dallas. I would then like
for the database to search a UserLocation table to verify that the
user is authorized to enter tickets for the location entered (we are
told who is authorized to enter data for out locations and this info
is in a table UserLocation).

Could someone help me understand how this might work and possibly
provide the simplest solution? I am for something short and sweet.
Thanks for any help.
 
P

Piet Linden

I have a data entry form that is called from a switchboard. One of the
selections on the switchboard is 'Enter in Work Ticket'. When clicked
I would like to have a box pop up to ask "What is your location". The
user would then type in a location such as Dallas. I would then like
for the database to search a UserLocation table to verify that the
user is authorized to enter tickets for the location entered (we are
told who is authorized to enter data for out locations and this info
is in a table UserLocation).

Could someone help me understand how this might work and possibly
provide the simplest solution? I am for something short and sweet.
Thanks for any help.

To get input from the user, you could use an InputBox, e.g.

strLocation=InputBox("What is your location?")

Kind of hard to tell further, without the structure of
UserLocation... How are you getting UserID? the GetUserName API
call?

Then you could create a DCount() against the UserLocation table where
UserName=fOSUserName() And UserLocation= ' " & strLocation & " ' "
as your criteria. If it's 1, then the user is authorized, if not,
you'll get 0.
 
D

Dale Fye

Personally, I think I would use a combo box, to only display the locations
for which the user has permissions to enter tickets. Assuming you are using
the fOSUserName function from (http://www.mvps.org/access/api/api0008.htm),
you could set the rowsource of the combo box to something like:

SELECT [Location] FROM UserLocation
WHERE [UserID] = fOSUserName
ORDER BY [Location]

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.
 

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