pull record from previous form

hzeigler4

Registered User.
Local time
Today, 06:38
Joined
Apr 18, 2007
Messages
42
I have a form(Family Info) that has a combo box containing a list of family names. The form displays details about the family based on the family selected in the combo box. I have a button on this form to Add a Family. This opens a blank form to enter a new family. When I click the save button the Add a Family form closes and I would like the Family info now to show the family I just added. Any ideas? I dont know why this has been so hard. It seems so easy. I can get the combo box to display the new family name, but it shows the previously selected familys info.
 
if the Family Info form remains open when you add a new family:
- in your Add a Family form:
Save_Click
Docmd.RunCmd acCommand acSaveRecord
Forms!FamilyInfo.Requery
Forms!FamilyInfo!cboSelect.Requery 'perhaps not required
Forms!FamilyInfo!cboSelect = Me.FamilyId
Forms!FamilyInfo.Requery
 
Thanks but I actually have that exact code in there right now and it does not work. The form does stay open while the other one is open as well. Any other ideas? I do not know why this seems so difficult for me. Any help is greatly appreciated!
 
You can't use that EXACT code unless your cbo boxes are named the same.
 
Yes I used my form name and cmbo box name and that is what does not work:

Docmd.RunCmd acCommand acSaveRecord
Forms!frmFamilyStudent.Requery
Forms!frmFamilyStudent!cmbFamilyName.Requery 'perhaps not required
Forms!frmFamilyStudent!cmbFamilyName= Me.FamilyId
Forms!frmFamilyStudent.Requery
 
a requery will not do what you require , try filtering using me.Filter or docmd.applyfilter. or you could use a quiery but what you cannot do is insert a key into a combobox and requery and expect it to find the record.
 
Here is the issue when I apply the filter. I applied a filter and turned the filter on. This WILL pull the correct information for the Family I just added. HOWEVER, I have record selectors on the bottom f the form that allows the user to go through the different records. It now says Filtered and it only shows that family I just added. There are actually 267 families but now when I filtered it will only show that one.
 
sorry, that wasn't very good. try this:
Code:
DoCmd.RunCommand acCmdSaveRecord
Forms!frmFamilyStudent.Requery
Forms!frmFamilyStudent!cmbFamilyName.Requery
    
Dim strSearch As String
strSearch = "FamilyStudentId = " & Me.FamilyStudentId
    
Forms!frmFamilyStudent.RecordsetClone.FindFirst strSearch
Forms!frmFamilyStudent.Bookmark = Forms!frmFamilyStudent.RecordsetClone.Bookmark
Forms!frmFamilyStudent.cboSelect = Null
    
DoCmd.Close acForm, Me.Name
 
Last edited:
Thanks Waaz!!! Works like a charm!!! And filters correctly in my navigation bar. I appreciate everyone's help as always!
 

Users who are viewing this thread

Back
Top Bottom