Autofilling from one table into another

Deb6508

Board Regular
Joined
Oct 25, 2004
Messages
131
Hi All,
What I am attempting to accomplish is to build a vacation request database that will be used online locally. I have an employees table that has employee names, employee number, manager etc. I then have a seperate table for each month of the year.
What I want is for the employee to sign in using their preassigned employee number and password. I then need to have this validated against the employee number and password in the database. What happens next is a subform opens with the months and then the employee can request, change or cancel vacation time.

The problem I am having is once the employee initially signs how do I validate the id and password against what I have in the database and allow the subform to open to only that employee information?

Or if there is a better way to do this then please let me know.

Any help would be appreciated.

Thanks in advance.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
If this is purely an Access question then I could recommend opening a query based form after the user has entered their details. If there entered data does not match that on record then you could close the database or provide a message. You could also use a bit of Windows API where the GetUserName function gets the users Network Logon which you validate in the same way. Hope this helps.
 
Upvote 0
Hmmm
Well I did the query for the signin but anything I enter it wants to either add a new record if the login is not there otherwise I get a message stating they would create a duplicate entry. :cry:
 
Upvote 0
Hi Deb

Sorry if my answer in your other thread was a little vague. I have found my old database with the (elementary) password control and following are instructions on how to set it up to test the password and then base the main form on the user id. There is no short way of describing this so here goes :

tblUsers
Logon_ID (unique, key)
Name
Password (text with an input mask of "password" - without the quotes, Required = Yes)
You could add other fields but the above list is the minimum I would expect

frmLogon
Basic form with 4 elements, not based on any table or query whatsoever :
Unbound text box with the name "ID_Attempt" (without the quotes)
Unbound text box with the name "PW_Attempt" & an input mask of "password" (both without the quotes)
OK button, which runs mcrLogon.Start in the "Onclick" event (ask if you are unsure)
Quit / Cancel button, with the VB command "DoCmd.Quit" attached to the onclick event (again, ask if you are unsure)

On the main database screen, click on Tools -> Startup -> under "Display Form/Page" select "frmLogon".

qryCheckPW
Paste this SQL into the query SQL design screen:
SELECT tblUsers.Logon_ID, tblUsers.Name, tblUsers.Password
FROM tblUsers
WHERE (((tblUsers.Logon_ID)=[Forms].[frmLogon].[id_attempt]));

qryCheckID
SELECT Count(qryCheckPW.Logon_ID) AS CountOfLogon_ID
FROM qryCheckPW;

frmCheckID
based on qryCheckID, add the "CountOfLogon_ID" field. Don't worry about formatting this form, it is not for viewing.

frmCheckPW
based on qryCheckPW, add the 3 fields. Don't worry about formatting this form, it is not for viewing except make sure the password field has an input mask of "Password" (without the quotes).

mcrLogon
After you create the macro, but before you enter any of the lines below, click on View -> Macro Names and also click on View -> Conditions. I have used the following formats for the lines on the macro : Line number (not actually entered into the macro but I have included it so you can follow this) : Macro name (if nothing, leave blank) : Condition : (if nothing, leave blank) : Action : Action Arguments (if any)

1 : Start : : OpenForm : frmCheckID, Data Mode = Read Only, Window mode = hidden {NB: per my format instructions above, there is no condition for this line hence the double ":"}
2 : : [Forms]![frmCheckID]![CountOfLogon_ID]<>1 : RunMacro : mcrLogon.WrongID
3 : : ... : StopMacro
4 : : : Close : Form, frmCheckID, No
5 : : : OpenForm : frmCheckPW, Data Mode = Read Only, Window mode = hidden
6 : : IsNull([Forms]![frmLogon]![PW_Attempt]) Or ([Forms]![frmLogon]![PW_Attempt]<>[Forms]![frmCheckPW]![Password]) : RunMacro : mcrLogon.WrongPW
7 : : ... : StopMacro
8 : : : Close : Form, frmCheckPW, No
9 : : : OpenForm : (Enter the name of your vacation request form), Set the view you want, Filter = blank, Where = "[Your user id field name on your form]=[Forms]![frmLogon]![ID_Attempt]", Data Mode = blank or restrict it to add or edit, Window mode = normal
10 : : ... : StopMacro
11 : : :
12 : WrongID : : MsgBox : enter a warning message for the user and change the type to "Warning!"
13 : : : Close : Form, frmCheckID, No
14 : : ... : StopMacro
15 : : :
16 : WrongPW : : MsgBox : enter a warning message for the user and change the type to "Warning!"
17 : : : Close : Form, frmCheckPW, No
18 : : ... : StopMacro

This could probably be tremendously simplified using VB but I don't know enough about VB to convert this entire process (yet).

Be aware that basic security such as this can be circumvented by holding down the shift key when the database starts, or by importing or linking the user table into another database - but those are separate issues.

If you are not sure of something please ask.

HTH, Andrew. :)
 
Upvote 0
I have handled this entire situation in VB and it is quite simple actually. I've even handled for if the user holds down the shift key. So far, no one has been able to get access to the data that I don't want them to access :) Of course, it's not like I'm working with a bunch of rocket scientists...

If you still are looking for a solution to your problem, look me up and I'll do what I can to show you what I've done.

Kevin
 
Upvote 0

Forum statistics

Threads
1,221,904
Messages
6,162,743
Members
451,785
Latest member
DanielCorn

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top