Here's a 'simple' problem (simple in the sense that it's confined to a few lines of code). I have an option button group on the parent form the user can click on to determine what records to show on the subform.
So when s/he clicks the option button, I want to include some code to update the RecordSource of the subform. Sounds easy. In the following code from the Click even of the main form;s option button, I get an error saying "" when I get to the critical line setting the subform;s recordsource.
Any ideas about what I'm missing here? Something about the link fields? I'm loosely following an example from page 210 of F Scott Barker's Access 2002 Power Programming book.
' code from click event of the main form option buttons
Dim strSQL As String
If Me.opgShow = 1 Then
' want full recordsource in subform
strSQL = "SELECT [list of fields] FROM [join condition]"
[Forms]![mainformName]![subformName].[Form].[RecordSource] = strSQL
Else
' want reduced recordsource in subform
strSQL = [list of fields] FROM [join condition] WHERE [expression limiting # rcds in subform]"
[Forms]![mainformName]![subformName].[Form].[RecordSource] = strSQL
End If
TIA
So when s/he clicks the option button, I want to include some code to update the RecordSource of the subform. Sounds easy. In the following code from the Click even of the main form;s option button, I get an error saying "" when I get to the critical line setting the subform;s recordsource.
Any ideas about what I'm missing here? Something about the link fields? I'm loosely following an example from page 210 of F Scott Barker's Access 2002 Power Programming book.
' code from click event of the main form option buttons
Dim strSQL As String
If Me.opgShow = 1 Then
' want full recordsource in subform
strSQL = "SELECT [list of fields] FROM [join condition]"
[Forms]![mainformName]![subformName].[Form].[RecordSource] = strSQL
Else
' want reduced recordsource in subform
strSQL = [list of fields] FROM [join condition] WHERE [expression limiting # rcds in subform]"
[Forms]![mainformName]![subformName].[Form].[RecordSource] = strSQL
End If
TIA