B
bob bob via AccessMonster.com
This is a new twist on a question I've posted previously.
I have a subform that consists of a continuous form that gets its data from
one of two queries. I want to change the recordsource between queries when
a button on the main form is clicked.
My onclick code is
Private Sub button_Click()
If Me!button.Caption = "query1" Then
Me!button.Caption = "query2"
Forms![main]![sub].Form.RecordSource = "query2"
Else
Me!button.Caption = "query2"
Forms![main]![sub].Form.RecordSource = "query1"
End If
Forms![main]![sub].Form.Requery
End Sub
The problem is that the subform shows no records after the code is run,
even though each query works fine if I manually enter it as the
recordsource before opening the form.
I've debugged the problem far enough to find that, although the
child/master fields on the main form start off blank, something in this
sequence fills them in and creates a relationship that makes the query come
up empty. Is there a way to block the child/master fields from auto-
filling?
I have a subform that consists of a continuous form that gets its data from
one of two queries. I want to change the recordsource between queries when
a button on the main form is clicked.
My onclick code is
Private Sub button_Click()
If Me!button.Caption = "query1" Then
Me!button.Caption = "query2"
Forms![main]![sub].Form.RecordSource = "query2"
Else
Me!button.Caption = "query2"
Forms![main]![sub].Form.RecordSource = "query1"
End If
Forms![main]![sub].Form.Requery
End Sub
The problem is that the subform shows no records after the code is run,
even though each query works fine if I manually enter it as the
recordsource before opening the form.
I've debugged the problem far enough to find that, although the
child/master fields on the main form start off blank, something in this
sequence fills them in and creates a relationship that makes the query come
up empty. Is there a way to block the child/master fields from auto-
filling?