setfocus from pop up back to already open form

burnout

Registered User.
Local time
Today, 13:58
Joined
Jan 26, 2006
Messages
17
Hi everyone,

I'm hoping I can get some help here.

I have a form with a search button. Click on search, search for member, then form should close and populate the fields on the form which is already open.

I figure I should use setfocus, but I am new to coding and need help. Right now, when the user clicks on the search record, it opens a new instance of the form instead of populating the data into the form that is already open.

I hope I am asking the question correctly.

This the event procedure I have set on the pop up search. It works, but is opening a new instance of the form. I tried replacing OpenForm to SetFocus with no luck.

Private Sub Member_Click()

DoCmd.OpenForm "frmDEMOGRAP", acNormal
[Forms]![frmDEMOGRAP]![txtMEMBNO] = Member
[Forms]![frmDEMOGRAP]![txtLSTNAM] = Last
[Forms]![frmDEMOGRAP]![txtFSTNAM] = First
[Forms]![frmDEMOGRAP]![txtMIDNAM] = MI
[Forms]![frmDEMOGRAP]![txtBTHDAT] = BirthDate
[Forms]![frmDEMOGRAP]![cmbGENDER] = gender

DoCmd.close acForm, "frmMEM", acSaveNo

End Sub


Thanks in advance for the help.
 
Have you looked into using an unbound ComboBox to find and move to a record of the underlying query/table? The ComboBox wizard will do all of the work for you.
 
Thanks for the help. I finally figured it out.

Private Sub Member_Click()
' Select the Main form control.
Forms![frmHF_group].SetFocus
' Select the subform control.
Forms![frmHF_group]![frmDEMOGRAP].SetFocus
' bring search data over to other form.
Forms![frmHF_group]![frmDEMOGRAP]![cmbEDUKEY].SetFocus
Forms![frmHF_group]![frmDEMOGRAP]![txtMEMBNO] = Member
Forms![frmHF_group]![frmDEMOGRAP]![txtLSTNAM] = Last
Forms![frmHF_group]![frmDEMOGRAP]![txtFSTNAM] = First
Forms![frmHF_group]![frmDEMOGRAP]![txtMIDNAM] = MI
Forms![frmHF_group]![frmDEMOGRAP]![txtBTHDAT] = BirthDate
Forms![frmHF_group]![frmDEMOGRAP]![cmbGENDER] = gender
Forms![frmHF_group]![frmDEMOGRAP]![txtSSN] = ssn

DoCmd.close acForm, "frmMEM", acSaveNo

End Sub
 

Users who are viewing this thread

Back
Top Bottom