sorry there is no search text on the one I posted before.
I change the recordsource of the subform when there is change in combo and search textbox.
Thanks again. This is exactly what I wanted to implement
sorry there is no search text on the one I posted before.
I change the recordsource of the subform when there is change in combo and search textbox.
sorry there is no search text on the one I posted before.
I change the recordsource of the subform when there is change in combo and search textbox.
Private Sub ComboPackage_AfterUpdate()
If Me.ComboPackage.ListIndex = -1 Or Me.ComboPackage = 0 Then
Me.LabelActivities.Caption = "Activities"
If Me.ComboPackage = 0 Then
ShowPackageFields True
Me.subFormPackageActivity.Form.RecordSource = "select * from " & strRecordSource & " where (1=0);"
Else
Me.subFormPackageActivity.Form.RecordSource = strRecordSource
End If
ElseIf Me.ComboPackage.Column(1) = "All" Then
With Me.subFormPackageActivity
.LinkMasterFields = ""
End With
Else
Me.LabelActivities.Caption = "Activities for " & Me.ComboPackage.Column(1) & " - " & _
Replace(Me.ComboPackage.Column(2), "&", "&&")
ShowPackageFields False
Me.subFormPackageActivity.Form.RecordSource = "select * from " & strRecordSource & " where PackageID=" & Me.ComboPackage
End If
Me.txtSearchActivity = Null
End Sub
Me.subFormPackageActivity.Form.RecordSource = "select * from " & strRecordSource & " where PackageID=" & Me.ComboPackage
see the rowsource of the combobox.
see also changes in the form code.
Arnel has not been around for a while.?
I *think* you wiped out the Master and Child link fields on the subform control.
This now appears to relink them.
HTH
Arnel has not been around for a while.?
I *think* you wiped out the Master and Child link fields on the subform control.
This now appears to relink them.
HTH
Well I am about to go to work.
It seems arnelgp was not using the link fields, but setting the recordsource in code in the afterupdate event of the combo. So remove those two entries.
I can see a problem with that already as All still allows you to add a new record, when you cannot possibly know which ID it is for.?
So I would look at setting the PackageID from the combo ONLY on new record, and disable Additions if combo is 0.5
Best I can do at present, sorry.
Can you explain the steps in how it is meant to work?
There is no code behing the Save button.
Any reason why the controls are unbound in the main form.?
OK, but please give the sequence steps on how it is meant to work.?
Eg
Create new package, Save, then add new records in subform?
OK, I think I might have it working now, as my old version still had the link fields. :-(
It still needs a fair bit of work, but at least the package id is now being saved to the child table
Try the attached.