Easy question but no so easy.

  • Thread starter Thread starter Rpettis31
  • Start date Start date
R

Rpettis31

I have a form that is filled out by customer service. This form is reviewed
by quality if a follow up action is required a button(macro) is pressed to
add a follow up form. I would like the customer service form id # to
populate the new form as well as the item referenced on the new form in the
like fields. I can do that by setting the fields equal to the original form
however I need to be able to open the form without having the orginal open.
Seems very easy but I am lost????
 
I'd be interested to know why the first form has to be closed and whether a
form/subform might better suit your needs but:

A simple way to accomplish this is to create an unbound, hidden form with a
text box. Before closing Form 1, set the text box value equal to the id #,
close Form 1 and open Form 2, set Form 2's id equal to the text box.
 
Rpettis31 said:
I have a form that is filled out by customer service. This form is
reviewed
by quality if a follow up action is required a button(macro) is pressed to
add a follow up form. I would like the customer service form id # to
populate the new form as well as the item referenced on the new form in
the
like fields. I can do that by setting the fields equal to the original
form
however I need to be able to open the form without having the orginal
open.
Seems very easy but I am lost????


I'm not sure what you mean when you say "without having the original open".
The original is open when you click the button on it to open the followup
form, right? Does that mean you want your button to open the followup form,
with some controls prepopulated, and close the original form? That's easy
enough; here's an example:

'----- start of example button code -----
Private Sub cmdFollowup_Click()

' Open Followup form to add a new record.
DoCmd.OpenForm "frmFollowup", DataMode:=acFormAdd

' Prepopulate certain controls from values on this form.
With Forms!frmFollowup
!CustSvcID = Me.CustSvcID
!SomeOtherControl = Me.SomeOtherControl
End With

' Close this form.
DoCmd.Close acForm, Me.Name, acSaveNo

End Sub
'----- end of example button code -----
 
Dirk,

How do I associate this code to a button on the form? I am sorry I am new
to this.

Thanks
Robert
 
Rpettis31 said:
Dirk,

How do I associate this code to a button on the form? I am sorry I am new
to this.

With the form open in design view, select the button and open its property
sheet. On the Event tab of the property sheet, click on the empty space to
the right of the "On Click" property. Then click the dropdown arrow that
will appear to the right, and select "[Event Procedure]". Then click the
little build button (caption "...") that will appear to the right of the
dropdown arrow.

That will put open the VB window for you, and create an event procedure
shell that looks like this:

Private Sub YourButtonName_Click()

End Sub

The text caret will be positioned for entry between those lines. What you
would do is copy and paste the code I gave you -- EXCEPT FOR THE SUB AND END
SUB LINES -- into that space. Then edit the code to use the correct form
and control names, instead of the ones I made up for the example. After
you've done that, save and close the form.

That's all there is to it.
 
Back
Top