Setting Up OpenArgs and OpenForm

M

mikeinohio

Hello, I have 4 forms in my data base, they are:

Menu
Find Client
Assessment1
Assessment2

what i wantto do is once i click a button on the menu form it will open a
popup ( find Client) to search for an existing client and once they are found
and hit ok, it will open the Assessment1 form with all thier information
filled out, and then once i fill out Assessment1 and click next Assessment2
opens up with the same basic information still filled in.

Can someone give me and example of the coding....
 
J

Jeanette Cunningham

Hi mikeinohio,
after a user has selected a client on the popup form, you could use code
like this:

Private Sub cmdAssmt1_Click()
DoCmd.OpenForm, "Assessment1", , , "[ClientID] = " & Me.ClientID
DoCmd.Close acForm, Me.Name
End Sub

cmdAssmt1 is the name of the button on the popup form.
ClientID is the primary key of the client table.
I have assumed ClientID is a Number data type.
If it is a text data type, use this instead

Private Sub cmdAssmt1_Click()
DoCmd.OpenForm, "Assessment1", , , "[ClientID] = """ & Me.ClientID & """"
DoCmd.Close acForm, Me.Name
End Sub

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
M

mikeinohio

ok, will that pass additiona info such as street address, phone number,
etc...to thier repective field in the form and how do i get this info to go
to the Assessment2 form....

Jeanette Cunningham said:
Hi mikeinohio,
after a user has selected a client on the popup form, you could use code
like this:

Private Sub cmdAssmt1_Click()
DoCmd.OpenForm, "Assessment1", , , "[ClientID] = " & Me.ClientID
DoCmd.Close acForm, Me.Name
End Sub

cmdAssmt1 is the name of the button on the popup form.
ClientID is the primary key of the client table.
I have assumed ClientID is a Number data type.
If it is a text data type, use this instead

Private Sub cmdAssmt1_Click()
DoCmd.OpenForm, "Assessment1", , , "[ClientID] = """ & Me.ClientID & """"
DoCmd.Close acForm, Me.Name
End Sub

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

mikeinohio said:
Hello, I have 4 forms in my data base, they are:

Menu
Find Client
Assessment1
Assessment2

what i wantto do is once i click a button on the menu form it will open a
popup ( find Client) to search for an existing client and once they are
found
and hit ok, it will open the Assessment1 form with all thier information
filled out, and then once i fill out Assessment1 and click next
Assessment2
opens up with the same basic information still filled in.

Can someone give me and example of the coding....
 
J

Jeanette Cunningham

Yes, you can make it do this. The question is:
why do you want the same information on 2 different forms?
I am concerned that you might be saving the address, phone number etc in
more than one table and this will cause problems for your database.
I suggest you read up on databases. Here is a link to a well-respected
article

Accesshttp://www.AccessMVP.com/strive4peace

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


mikeinohio said:
ok, will that pass additiona info such as street address, phone number,
etc...to thier repective field in the form and how do i get this info to
go
to the Assessment2 form....

Jeanette Cunningham said:
Hi mikeinohio,
after a user has selected a client on the popup form, you could use code
like this:

Private Sub cmdAssmt1_Click()
DoCmd.OpenForm, "Assessment1", , , "[ClientID] = " & Me.ClientID
DoCmd.Close acForm, Me.Name
End Sub

cmdAssmt1 is the name of the button on the popup form.
ClientID is the primary key of the client table.
I have assumed ClientID is a Number data type.
If it is a text data type, use this instead

Private Sub cmdAssmt1_Click()
DoCmd.OpenForm, "Assessment1", , , "[ClientID] = """ & Me.ClientID & """"
DoCmd.Close acForm, Me.Name
End Sub

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

mikeinohio said:
Hello, I have 4 forms in my data base, they are:

Menu
Find Client
Assessment1
Assessment2

what i wantto do is once i click a button on the menu form it will
open a
popup ( find Client) to search for an existing client and once they are
found
and hit ok, it will open the Assessment1 form with all thier
information
filled out, and then once i fill out Assessment1 and click next
Assessment2
opens up with the same basic information still filled in.

Can someone give me and example of the coding....
 
M

mikeinohio

no its just a continuation of the Assessment1 form, the information is only
stored in one table, i just want the users to be able to knwo they are still
entering information for the same client nd not a difetent client, but the
new information is linked in a one-to-many relationship in its own table, if
i making any sense.

Jeanette Cunningham said:
Yes, you can make it do this. The question is:
why do you want the same information on 2 different forms?
I am concerned that you might be saving the address, phone number etc in
more than one table and this will cause problems for your database.
I suggest you read up on databases. Here is a link to a well-respected
article

Accesshttp://www.AccessMVP.com/strive4peace

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


mikeinohio said:
ok, will that pass additiona info such as street address, phone number,
etc...to thier repective field in the form and how do i get this info to
go
to the Assessment2 form....

Jeanette Cunningham said:
Hi mikeinohio,
after a user has selected a client on the popup form, you could use code
like this:

Private Sub cmdAssmt1_Click()
DoCmd.OpenForm, "Assessment1", , , "[ClientID] = " & Me.ClientID
DoCmd.Close acForm, Me.Name
End Sub

cmdAssmt1 is the name of the button on the popup form.
ClientID is the primary key of the client table.
I have assumed ClientID is a Number data type.
If it is a text data type, use this instead

Private Sub cmdAssmt1_Click()
DoCmd.OpenForm, "Assessment1", , , "[ClientID] = """ & Me.ClientID & """"
DoCmd.Close acForm, Me.Name
End Sub

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

Hello, I have 4 forms in my data base, they are:

Menu
Find Client
Assessment1
Assessment2

what i wantto do is once i click a button on the menu form it will
open a
popup ( find Client) to search for an existing client and once they are
found
and hit ok, it will open the Assessment1 form with all thier
information
filled out, and then once i fill out Assessment1 and click next
Assessment2
opens up with the same basic information still filled in.

Can someone give me and example of the coding....
 
J

Jeanette Cunningham

One easy way is to make a small form for just the address etc info.
Use this form as a subform on any other form where you want to show the
client info.
I use this arrangement for client address info and it works well for me.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


mikeinohio said:
no its just a continuation of the Assessment1 form, the information is
only
stored in one table, i just want the users to be able to knwo they are
still
entering information for the same client nd not a difetent client, but the
new information is linked in a one-to-many relationship in its own table,
if
i making any sense.

Jeanette Cunningham said:
Yes, you can make it do this. The question is:
why do you want the same information on 2 different forms?
I am concerned that you might be saving the address, phone number etc in
more than one table and this will cause problems for your database.
I suggest you read up on databases. Here is a link to a well-respected
article

Accesshttp://www.AccessMVP.com/strive4peace

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


mikeinohio said:
ok, will that pass additiona info such as street address, phone number,
etc...to thier repective field in the form and how do i get this info
to
go
to the Assessment2 form....

:

Hi mikeinohio,
after a user has selected a client on the popup form, you could use
code
like this:

Private Sub cmdAssmt1_Click()
DoCmd.OpenForm, "Assessment1", , , "[ClientID] = " & Me.ClientID
DoCmd.Close acForm, Me.Name
End Sub

cmdAssmt1 is the name of the button on the popup form.
ClientID is the primary key of the client table.
I have assumed ClientID is a Number data type.
If it is a text data type, use this instead

Private Sub cmdAssmt1_Click()
DoCmd.OpenForm, "Assessment1", , , "[ClientID] = """ & Me.ClientID &
""""
DoCmd.Close acForm, Me.Name
End Sub

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

Hello, I have 4 forms in my data base, they are:

Menu
Find Client
Assessment1
Assessment2

what i wantto do is once i click a button on the menu form it will
open a
popup ( find Client) to search for an existing client and once they
are
found
and hit ok, it will open the Assessment1 form with all thier
information
filled out, and then once i fill out Assessment1 and click next
Assessment2
opens up with the same basic information still filled in.

Can someone give me and example of the coding....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top