Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selection Dictates Next Form?

Status
Not open for further replies.

tresanus

Technical User
Oct 7, 2007
84
US
I have recently made a survey using Microsoft Access 03. I am a very new user to Access and learning as much as I can from TT and other websites.

Now the survey I have created is set up to collect test data on prototype machines. If the machine fails to perform correctly the tester will use my form to relay the data to us. Now I would like to create a login and password for the tester and have the form run much like a computer program would look.

I have already learned how to create the form to look much like a survey or questionnaire so that part has been taken care of.

1. I would like to learn how to create a login for new users
2. I would like my form to add any newly created users to a drop down list
3. I would love to learn how to have selections determine the next "page" in the form.

I have not learned how to create multiple "pages" for a form. For instance, say the machine did not function because of a power issue. Well I would like the tester to drop down a list that states [Power Issue] and then click NEXT. This would take them to a form dedicated to Power Issues (with different forms for all the different troubleshooting issues). But if possible, have all this data store into one main table.

Now like I said I am a very new user and I don't know if what I am looking for is even possible, this is just what my client is looking for!

I appreciate any help you guys provide, I couldn't have gotten at least this far without you guys!
 
1. I wouldn't bother. Instead return the computer username in code by using the environment variable..

Code:
environ ("username")

2. In this code below you need to repleace YourTableName and FieldForUser with your table name and field. Enclose them in square brackets if they contain spaces or other non-alpha characters. Although I would probably skip this altogether as they don't need to log in with my method.

Code:
docmd.setwarnings false 'Turns off warnings like confirming appends
docmd.runSQL "INSERT INTO YourTableName ( FieldForUser ) SELECT Environ(""Username"")"
docmd.setwarnings True 'Turn warnings back on

3. Create a table for your drop down. Add a column/field for a form name. Be sure to include the form name field in your combobox (you can make the column width 0 if you want to make it invisible).

On the button's click event open the form from the combobox using the data in the column...

Code:
docmd.openform Me!ComboBoxName.column(1)

ComboBoxName is the name of your combobox (or list box for that matter) and 1 refers to element 1 in a 0 based array (progammer speak for 0 is first 1 is second etc.). You may need to change 1 if your form name isn't your second column.
 
I'm not a fan of the ENVIRON() function since it is not always reliable across all versions of Windows. There is a fairly easy to use function that should work.

You didn't state anything about your table structure. Have you looked at At Your Survey. This is a basic demo of a working table structure so it doesn't include branching to different questions based on responses.

Duane
Hook'D on Access
MS Access MVP
 
I guess I should update - I have 0 experience with VBA.

I am searching high and low to find some good walk-throughs/videos/tutorials with some basic VBA steps.

:-0
 
I find that in networked environments that Environ works fine as it is Ok for NT based OS's on a domain.

As far as knowledge with Access. I personally love the Access Developer's Handbook series published by Sybex (I have the 97 and 2000 versions). I think Litwin is the common contributing author accross them but Getz stands out too.

Unfortuantely I don't have the time ATM to help more specifically.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top