Static login: copying data from login to other data

I am trying to work on a static login function that looks like this. This is not your everyday login with password thing, but something like a data entry log.

The data entry log looks like this:

Date: _3/24/05_
Day: _Thurs_
Time: _7:00AM_
Oper: _MM_

And with that info, I need to set up a control table and be able to have the same info logged on to the other form as a static data entry log so it doesn't have to be retyped for each form.

If you have any questions, I will be glad to answer it.

Basically, what I'm looking for is a sort of a statement that allows me to "copy" the log information from the login screen to other forms. I need to know what's the best way to do it.

David
hawkeyexAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Steve BinkCommented:
Sure thing!  Create your login form with one command button on it.  Make the first form your users see upon opening the database.  When they enter their information and click the button, the OnClick event should a) check for info, b) authenticate if necessary, c) hide the 'login' form, d) open the next form in the series (presumably your switchboard..?).

As your users do their work, the login form is still open but hidden.  From the other forms, you can reference the login form at any time to pull the info they entered.
0
hawkeyexAuthor Commented:
How can I reference the login form? That's what I need to know.
0
Steve BinkCommented:
Forms![MyLoginFormsName]![MyControlName]

OR

Forms("MyLoginFormsName")![MyControlName]
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

hawkeyexAuthor Commented:
Last question.. where do I put that in? I put it in the Default Value, and it didn't work.
0
Steve BinkCommented:
You would have to assign the value to the control when you need it.  For example, before saving the record (if you have a save button as opposed to letting Access do it automatically), check to see if those fields are populated.  If not, populate them.  Or, when a new record is created, populate the fields right from the start (which has other benefits, also).  Or, when the form's OnCurrent event fires, use that opportunity to see if the fields are populated, and if not, ask the user if they want to add that data.  There are any number of ways this could be done.
0
hawkeyexAuthor Commented:
Could you tell me, as a newbie, how it can be done?

David
0
BillystyxCommented:
or, in a module put this:
Date: _3/24/05_
Day: _Thurs_
Time: _7:00AM_
Oper: _MM_
Option Explicit


Public Type UserInfo
    Date1 As String
    DayName As String
    TimeName As String
    Password As String
    Oper As String
   
End Type

Public User As UserInfo

Then on your login form on the command button to enter, feed all the info into these variables like
User.Date1=Me.Date1
etc
Then, on current event of each form
Me.Date1=User.Date1
and so on

Billystyx
0
Steve BinkCommented:
First, create your login form.  Obviously it will have controls for Date, Time, Day, and Operator.  The Date/Time/Day fields can have their DefaultValue property set to the appropriate functions: Date(), Time(), Weekday(Date()).  For the operator, you can either have a textbox for the user to enter their identity, or perhaps a combobox for easy selection.  You should also place one command button for submitting the login.  Its OnClick should look something like this:

Private Sub MyCommandButton_OnClick()

Me.Visible = False
DoCmd.OpenForm "TheNEXTFormTheyWillSee"

End Sub

As I said before, "TheNEXTFormTheyWillSee" is likely to be your main switchboard.  From here, the rest of the app works as normal.  When the user finally gets into a data entry form and you need to insert information from your login form, simply reference it as: Forms![MyLoginFormsName]![MyControlName]

Before asking for more information on this, give it a try.  It is a relatively simple task with no authentication.  If you run into a problem or get stuck somewhere, come back and post here, and I'll walk you through that section.  
0
hawkeyexAuthor Commented:
It is partially working. The only thing that is giving me errors is this:

[Forms]![Login]![strDay] will return an #error - it is a string on Login form
[Froms]![Login]![strOper] will return an #error - it is a string on Login form

The other two (day and time) works just fine when passed as Day/Time

David
0
hawkeyexAuthor Commented:
er make that [Forms]![login]![strOper] - obvious typo.
0
Steve BinkCommented:
Post the code in which you are receiving the error.  The reference should work as is, just like the other two.
0
hawkeyexAuthor Commented:
How? How do I show you the code?
0
Steve BinkCommented:
From the Design view of the form, press Alt-F11.  Access should bring up the IDE window, directed to the module for your form.  
0
hawkeyexAuthor Commented:
Here you go:

Option Compare Database
Option Explicit

Global dtDate As Date
Global dtTime As Date
Global strDay2 As String
Global strOperator As String

Function GetUDate() As Date
GetUDate = dtDate
End Function

Function GetUTime() As Date
GetUTime = dtTime
End Function

Function GetUDay() As String
GetUDay = strDay2
End Function

Function GetUOperator() As String
GetUOperator = strOperator
End Function


0
hawkeyexAuthor Commented:
Oops. I see. Let me try something a bit different.

0
hawkeyexAuthor Commented:
Nope. Didn't work. Any ideas?
0
hawkeyexAuthor Commented:
if it helps, the login button looks like this:

Option Compare Database


Private Sub Login_Click()
dtDate = Me!dtDate
dtTime = Me!dtTime
strDay = Me!strDay
strOperator = Me!strOperator
DoCmd.OpenForm "Switchboard"
End Sub
0
Steve BinkCommented:
Is the first bit of code you posted in the same module as the second bit?  Your login form's code should look like this:

Option Compare Database

Private Sub Login_Click()
    Me.Visible = False
    DoCmd.OpenForm "Switchboard"
End Sub

There should be nothing else in the module for your login form.  If those other variable declarations are in there, delete them.  They are unnecessary redundancies, and apparently use the same names as the controls on your form...never a good idea.  There will be PLENTY of code in other modules, so be careful of where you are editing.  When your users click the login button, the login form should appear to go away, but you can still reference the information they put there with these:

Forms!MyLoginFormName!strOperator
Forms!MyLoginFormName!strDay
etc...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
hawkeyexAuthor Commented:
Would it be easier if I gave you a copy of my DB so you can see what I'm having trouble with?

0
hawkeyexAuthor Commented:
Still awaiting response.
0
Steve BinkCommented:
It would be, but that is against policy here at EE.  How about I make a working model for you and send it through email so you can see it work?  I can post the code here for future EE searches, and you get to see exactly what I'm talking about.  Deal?  If you're good with that, put an acceptable email address in your profile.
0
hawkeyexAuthor Commented:
How about if I sent you the DB via your e-mail if it works?
0
Steve BinkCommented:
That will work, too, but Hotmail has been having some issues with attachments recently...the virus scanner seems to think EVERYTHING is infected.  Also, I prefer to just make something I know is clean from the start rather than patching into a project-in-progress, so to speak.  

In any case, please make a structural copy of the db with only your objects and code...remove all the data.  Compact and zip before sending.
0
hawkeyexAuthor Commented:
I figured out the problem. Your solution works fine. It was a error on my part.
0
Steve BinkCommented:
Glad you got it sorted out!  :)  Good luck with the rest of your project.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.