If Nz(Me!cboxMonth, 0) = 0 Then
' If the combo is Null, use the whole table as the RecordSource.
Me!Forms!frmItemVolumeSpend.RecordSource =
"QryAdageVolumeSpendYear"
Else
' If not Null, it uses a query to bring the only vendors that
match the branch
Me!Forms!frmItemVolumeSpend.RecordSource = "QryAdageVolumeSpend"
You can change either. But you must have the syntax correct.
If you are wanting to change the recordsource for the current form, use:
Me.RecordSource = "NameOfRecordSource"
You cannot use Me.Forms...., because a form does not contain the Forms
collection. You can use that syntax to change the recordsource of a
different form, but you must omit the Me:
Forms.FormName.RecordSource = "NameOfRecordSource"
If you want to change the recordsource of a subform on the current form use:
Me.NameOfSubformcontrol.Form.RecordSource = "NameOfRecordSource"
Why are you doing that rather than just filtering the form?
This is what I have
Private Sub cboxMonth_AfterUpdate()
If Nz(Me!cboxMonth, 0) = 0 Then
' If the combo is Null, use the whole table as the RecordSource.
Me!Forms!frmItemVolumeSpend.RecordSource =
"QryAdageVolumeSpendYear"
Else
' If not Null, it uses a query to bring the only vendors that
match the branch
Me!Forms!frmItemVolumeSpend.RecordSource = "QryAdageVolumeSpend"
End If
End Sub
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.