Passing a prameter in Access from a form (1 Viewer)

chris_elevate

Registered User.
Local time
Today, 16:38
Joined
Apr 18, 2008
Messages
27
Hi,

I'm creating a mdb for a DVD hire company.

I'm trying to create a form which loads on startup (done this part)... which will let the user select which branch they are using (one of three) and then proceed to another form. When the user selects the branch '' I want the system to store the branch name and use it in the label which follow.

Attached are two pictures to illustrate.

Hope it makes sense what I'm trying to do.

I guess it's got something to do with passing the parameter from the welcome screen and then using that variable on other forms?!?!?
 

Attachments

  • branch-selection-screen.jpg
    branch-selection-screen.jpg
    34 KB · Views: 87
  • customer-form.jpg
    customer-form.jpg
    51.4 KB · Views: 90
Last edited:

boblarson

Smeghead
Local time
Today, 08:38
Joined
Jan 12, 2001
Messages
32,059
The EASIEST way is to have a hidden form with an unbound control to store the value in and then you can refer to it from any form. It also guarantees against a public variable changing, or losing its value, in certain conditions.
 

chris_elevate

Registered User.
Local time
Today, 16:38
Joined
Apr 18, 2008
Messages
27
Thanks,

How would I go about doing this in this instance then?
 

sierra467

Registered User.
Local time
Today, 11:38
Joined
Aug 1, 2005
Messages
66
Another thought

I do not have too much experience, but if you use a DoCmd to open your form and use the OpenArgs argument to pass the name you want to use in the new form's Load event, it might be an other way to go.

Sending Form's DoCmd
Code:
DoCmd.OpenForm "FormName", , , , , , "DataYouWantToPassToOtherForm"
'Or in your case
DoCmd.OpenForm "frmTM_Customer", , , , , , "Brackley"

Receiving Form's Load Event
Code:
Private Sub Form_Load()
    MsgBox "The Item you are passing is: " & Me.OpenArgs
    'or maybe you could assign it to a Global or Local variable like this?
    Dim strBranch as String
    strBranch = Me.OpenArgs
End Sub

Just a thought.
 

Users who are viewing this thread

Top Bottom