Form to Form connection

  • Thread starter Thread starter Sondra
  • Start date Start date
S

Sondra

I have a form created that automatically adds the number
to the field. Using the following control source:

=Right([YearCreated],2) & "CC-" & Format([CCLog#],"000")

After all the necessary data is entered into the form, I
have a Command Button that opens another form using a
macro. I have the macro coming from a query using the
same table as used in the original form with a parameter
query asking for the CC# that I want to open.

I want the 2nd form to open with the CC# field already
entered and having the same number as assigned in the
first form. When the second form opens the query asks
which CC# I want and I enter the number that was just
assigned to the first form and assigned into the table.
However, it doesn't work. Can someone tell me what I'm
doing wrong.

Thanks in advance.
 
You can supply a Where conditions to filter the form when you open it.
Like...

Make sure the form is saved first

If Me.Dirty Then Me.Dirty = False
DoCmd.OpenForm "frmOtherForm",,,"CC#='" & Me.CC# & "'"

Substitute the correct form name for "frmOtherForm"

- Jim
 
Help....
I'm not much into the programming end of this yet, so I'm
not exactly sure where to put the statement as identified
in the response to my email. Can some give me further ad
vice??????
-----Original Message-----
You can supply a Where conditions to filter the form when you open it.
Like...

Make sure the form is saved first

If Me.Dirty Then Me.Dirty = False
DoCmd.OpenForm "frmOtherForm",,,"CC#='" & Me.CC# & "'"

Substitute the correct form name for "frmOtherForm"

- Jim

I have a form created that automatically adds the number
to the field. Using the following control source:

=Right([YearCreated],2) & "CC-" & Format([CCLog#],"000")

After all the necessary data is entered into the form, I
have a Command Button that opens another form using a
macro. I have the macro coming from a query using the
same table as used in the original form with a parameter
query asking for the CC# that I want to open.

I want the 2nd form to open with the CC# field already
entered and having the same number as assigned in the
first form. When the second form opens the query asks
which CC# I want and I enter the number that was just
assigned to the first form and assigned into the table.
However, it doesn't work. Can someone tell me what I'm
doing wrong.

Thanks in advance.

.
 
Open the properties window for the command button. Select the event
tab, select the On Click event and click the elipsis button [...] on
the right of the event. If the builder window opens, select Code
Builder to open the form's module. You should see something like ...
------------------------------
Private Sub cmdButton_Click()

End Sub
------------------------------
Your button name will replace "cmdButton". Now paste the code between
the two statements; supplying your form name and fields instead of
what I provided. It would be something like...
---------------------------------------
Private Sub cmdButton_Click()
If Me.Dirty Then Me.Dirty = False
DoCmd.OpenForm "frmOtherForm",,,"CC#='" & Me.CC# & "'"
End Sub
----------------------------------

- Jim

Help....
I'm not much into the programming end of this yet, so I'm
not exactly sure where to put the statement as identified
in the response to my email. Can some give me further ad
vice??????
-----Original Message-----
You can supply a Where conditions to filter the form when you open it.
Like...

Make sure the form is saved first

If Me.Dirty Then Me.Dirty = False
DoCmd.OpenForm "frmOtherForm",,,"CC#='" & Me.CC# & "'"

Substitute the correct form name for "frmOtherForm"

- Jim

I have a form created that automatically adds the number
to the field. Using the following control source:

=Right([YearCreated],2) & "CC-" & Format([CCLog#],"000")

After all the necessary data is entered into the form, I
have a Command Button that opens another form using a
macro. I have the macro coming from a query using the
same table as used in the original form with a parameter
query asking for the CC# that I want to open.

I want the 2nd form to open with the CC# field already
entered and having the same number as assigned in the
first form. When the second form opens the query asks
which CC# I want and I enter the number that was just
assigned to the first form and assigned into the table.
However, it doesn't work. Can someone tell me what I'm
doing wrong.

Thanks in advance.

.
 
Back
Top