Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 7th, 2005, 07:54 AM
Authorized User
 
Join Date: Feb 2004
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Default passing infos

Hello everyone again
ok i have a login form which will ask for username and password and the username and password is ok then the login form will be closed and the main menu form will be open now how can i pass the id of my username from the login form in to the main menu?
Thanks for your help

Best Regards,
Hamed Gholamian
 
Old February 7th, 2005, 10:24 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 100
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Hamed,

If you are using the built in Access Workgroup funtionality you can use the access function CurrentUser() to get the current user name. For example, if you need to display the logged in user in a text control on your main form you can do something like this -

=[CurrentUser] & " is logged on here."

HTH

Jon
 
Old February 7th, 2005, 10:32 AM
Authorized User
 
Join Date: Feb 2004
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Default

no ok this is the scenario
table = tbusers
fields = id,ingun,ingps,ingac
and i use this fields in my login form
now if the username and password is ok then the login form will be closed and the main menu will open
but how can i pass the value of id(which w=is username id)pass in the second form(main menu)
because i want to show the current username


Best Regards,
Hamed Gholamian
 
Old February 7th, 2005, 10:46 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 100
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Have you tried passing the values in the openargs of the openform method? If you have got the details already on the login form you can just pass the details and handle them when the main form loads. Decalre a private variable in the declarations of your main form and use that.

DoCmd.OpenForm "frm_Main", , , , , , txtUserName

Then when the main form opens handle the value -

'Declarations
Private strUser as string

Private Sub Form_Load()
    If Not IsNull(OpenArgs) Then
        'populate the mod level var with the openargs
        strUser = OpenArgs
        'or perform some other action if required???
    End If
End Sub

Alternativly if you need to access this value globally create a new module and declare the strUser variable as public. when your password form closes just populate the global variable. -

strUser = txtUserName

The variable will then be accessible to all database objects.

Any good???
 
Old February 7th, 2005, 10:50 AM
Authorized User
 
Join Date: Feb 2004
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Default

let me try it and see what happen

Best Regards,
Hamed Gholamian
 
Old February 7th, 2005, 11:12 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 100
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hamed,

Sorry, Ignore the part about global variables. You would need to create a class module for this to work. The easiest way is to use the openargs argument of the openform method.
 
Old February 7th, 2005, 12:24 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hamed,

You can create an unbound text box on your main menu. Once you have verified the user, open the main menu BEFORE YOU CLOSE THE LOGIN SCREEN.
Set the value of your unbound text box to your user id, and THEN close your login form.

Good Luck,

Kevin

 
Old February 7th, 2005, 01:00 PM
Authorized User
 
Join Date: Feb 2004
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ok that was a first thing which i had done and it was fine but one problem how can i close that form without notifying the user and ask user to close it?

Best Regards,
Hamed Gholamian
 
Old February 7th, 2005, 01:04 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

are you using vb code to verify the user id and password? If so, after you have verified it, use the docmd.closeform to close the login form.

does that help?

Kevin

 
Old February 7th, 2005, 02:54 PM
Authorized User
 
Join Date: Feb 2004
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yes i use vb code but if i close the form how can i tell my other form to use the same id when there is no form i even public my intiger but it doesnt work

Best Regards,
Hamed Gholamian





Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with passing args Siblja Java Basics 1 February 6th, 2007 10:24 AM
Passing value without using sessions lic023 Classic ASP Basics 1 July 20th, 2004 09:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.