data from one form to another.

  • Thread starter gmenon100 via AccessMonster.com
  • Start date
G

gmenon100 via AccessMonster.com

Hello Friends,

I have an ADP project with two forms. On the Form1 i have 1 unbound combobox1
connected to a tableabc and a subform1.

Based on the selection in the combobox, data is filtered in the subform1.
This works fine. I want to incorporate a command button on this form1 which
when clicked will open the second form2 and copy value from the combobox1
into form2's combobox2.

Is this possible and if so can you help me to code this.

Thank you in advance.

Gmenon
 
S

shelly2 via AccessMonster.com

I'm a beginner. I will tell you how I did this, which may not at all be the
best way. Maybe someone else can come along and enlighten both of us as to a
better way.

Private Sub CommandButton_Click()
Dim Str as String

DoCmd.OpenForm "Form2"
Combobox1.SetFocus
Str = Combobox1.Text

Forms!Form1.Form.Combobox2.SetFocus
Forms!Form1.Form.Combobox2.Text = Str

End Sub

Good Luck.
 
G

gmenon100 via AccessMonster.com

Thanks for your response Shelly.

This is what I did after searching thru this forum:

on Form1 cmdbutton click event:

Private Sub Command41_Click()
strPassValues = Me.cmb1STATS & "~" & Me.cmb1SHP
DoCmd.OpenForm "paymentstatusupdate", , , , , , strPassValues

End Sub

on the form2 load event:


Private Sub Form_Load()
Dim varValues As Variant

If Not IsNull(Me.OpenArgs) Then
varValues = Split(Me.OpenArgs, "~")
Me.cmb2STATS = varValues(0)
Me.cmb2SHP = varValues(1)
End If
End Sub

This works fine. You may try this as you can define all the field you want
to transfer to the 2nd form.

The only problem I am having is though the field (cmb2stats) on the 2nd form
appear, but the suborm on this second form does not populate based on the
cmb2stats. I have to manually click this cmbox and select the data for the
subform to populate. I hope someone reading this will throw some light.


gmenon
 

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