Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA 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 July 13th, 2003, 08:11 PM
Authorized User
 
Join Date: Jul 2003
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default Retreiving data from unbound field?

I have couple of questions on setting up user login. I have a table named EmployeeList with userID and Pswd feilds. I have setup a login form with a listbox for userID and would like to verify the Pswd in my table with the one typed in, and keep the userID in memory to use in other parts of my database...

Any help would be appreciated!

Thanks
Dan
 
Old July 13th, 2003, 08:22 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well - I would first suggest that you use standard Access User security - that will solve a lot of your problems.

Steven

There are 10 kinds of people in the world - those who understand binary - and those with friends
 
Old July 23rd, 2003, 06:13 AM
Authorized User
 
Join Date: Jul 2003
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Steven,

Well my setup has changed, I'm told it doesn't have to be a secure database!!! The problem I'm having is i can't select a user, the list box is there but I can't select anything?

How can I retreive the user that is selected and use that in the rest of my database while they are logged in?

Dan
 
Old July 23rd, 2003, 06:57 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Quote:
quote:Originally posted by lanctotd
Well my setup has changed, I'm told it doesn't have to be a secure database!!! The problem I'm having is i can't select a user, the list box is there but I can't select anything?

How can I retreive the user that is selected and use that in the rest of my database while they are logged in?
Dan,

First, make sure your list field is enabled and not locked. If you don't want users other than what's on your list to be chosen, make sure the Limit to List property is set to YES.

To use someone selected in one form on other forms, either create a global variable and assign your choice to that variable to use elsewhere, or keep the logon form open but hidden so that field is available to memory. Personally, I don't like to keep any forms open unless necessary so I like the former approach, not the latter.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old July 23rd, 2003, 12:44 PM
Authorized User
 
Join Date: Jul 2003
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Is there anyplace I can get info on how create a global variable and on how to close forms when another is opened?

Dan
 
Old July 23rd, 2003, 01:26 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Quote:
quote:Originally posted by lanctotd
Is there anyplace I can get info on how create a global variable
Using Access help should do it for you, but just in case Microsoft's help is cryptic and confusing (which it tends to be), basically: Open a new module. On the top just after you see "Option Compare Database" declare your global variable, e.g.

Code:
    Public gstrLoggedUser As String
Then in your logging in form, you set gstrLoggedUser = Me.txtLoggedUser or whoever was in that text box. To make a global constant variable, you do this:

Code:
    Public Const vbGray As Long = 8421504
I use the above constant a lot because there is no vbGray for text color in Access unless you use the RGB function.

Quote:
quote:and on how to close forms when another is opened?
Use the DoCmd.Close method, e.g.

Code:
    DoCmd.Close acForm, "Order Review", acSaveYes
Access help is pretty good for this one.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old July 26th, 2003, 11:19 AM
Authorized User
 
Join Date: Jul 2003
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

One more question on this...

I've sorerd my value: gstrLoggedUser = EmployeeName.Value

In my new form I would like to call this value and when the data is entered it will update my table?

Thanks
 
Old July 28th, 2003, 07:12 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Quote:
quote:Originally posted by lanctotd
I've sorerd my value: gstrLoggedUser = EmployeeName.Value

In my new form I would like to call this value and when the data is entered it will update my table?
To use the value just include it in your expression. For example,

Code:
msgbox "The stored user is " & gstrLoggedUser & ".", _
   vbInformation, "FYI"


As for putting into a table, you can put any value (whether it's a global or local one) into any table.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division





Similar Threads
Thread Thread Starter Forum Replies Last Post
unbound field in subform chacquard Access VBA 4 February 7th, 2007 10:01 AM
Posting the value of an unbound form field into a ebburks Access 8 May 27th, 2006 04:38 PM
unbound field in a form zanza67 BOOK: Access 2003 VBA Programmer's Reference 0 September 3rd, 2005 01:46 PM
Unbound field lee27 VB Databases Basics 1 January 5th, 2005 07:53 AM
How to bind unbound field ? cjordan BOOK: Professional Crystal Reports for VS.NET 1 January 23rd, 2004 01:34 PM





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