Open different forms when in runtime

mrgunner

Registered User.
Local time
Today, 11:00
Joined
Feb 24, 2009
Messages
24
Hope you can understand me when english isn´t my language.

I´ve done a database on my work and renamed it to .accdr in the end. What I want is a shortcut to open the form "a" for some people and for some other I would like a shortcut to open form "b". Is that possible? Hope this make sense :rolleyes:

/Markus
 
Your written english is better than some who speak it as a first language on this forum. ;)

You need to use the OpenForm method. Check out this link for the details...
http://msdn.microsoft.com/en-us/library/aa141520(office.10).aspx

Here is a code example...
Code:
DoCmd.OpenForm "formA"
DoCmd.OpenForm "formB"

Search around the forum and aslo the link above for you can learn a lot from what is in cyber space on programming in VBA.
 
You might want to consider the 'getuser' method in this example which returns the loginID of the user. You can then code in (based on the getuser value returned), which form should open.

Getuser method:
http://www.dbforums.com/6274790-post20.html

Ex:

If getuser() = "jakes" then docmd.openform "formA" else docmd.openform "formB"
 
Thanks to both of you, but I suck at vba but are trying to learn and read what you linked. Thought there was a solution to this out of vba.

But I found a different thing that kind of do what I want.

This routine will create a shortcut on the user's desktop that will just open up a form, the Access main window is hidden.

1- Create a macro that opens the form in Window Mode: Dialog

2- (optional)I usually have a "Close" command button that is coded:
DoCmd.Quit
and set the form's Close Button property to No

3- Create a new shortcut on the desktop. If you use the wizard, for the location text box enter:
"C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE" "M:\CompanyApps\Task.mdb" /x "OpenTask"

**Include the quotation marks and spaces**
The format is: the location of the Access exec, the location of the mdb file, /x (run a macro), the macro name

4 - Right click on the new shortcut and choose properties. Change the Run dropdown to Minimized.

5 - You can rename the shortcut and change the icon

6 - If you have multiple users, you can distribute the shortcut ***the path to their exec file has to be the same, it usually is.
 
Yes. This is a 'work-around' type solution which is actually more difficult to implement/maintain versus the link I posted (I did something similar before I created the getuser() and permissions routine). But to each his own.
 
I will try your getuser() solution and see if I could get it to work. Why is the other more difficult to maintain?
 
I'll have to get back to you on that. It's getting late and I had to answer a very long post earlier.

Just trust me with the getuser() method. Everyone who has used it has always told me they wondered how they survived without it.
 

Users who are viewing this thread

Back
Top Bottom