Greetings:
I have scoured the internet and gotten several useful tips from the experts here, though, I still have the same problem.
I have a form with a combo box with a rowsource connected to tblState which is a simple state lookup table. The rowsource is as follows:
SELECT tblState.idnStateID, tblState.StateLong FROM tblState UNION SELECT "*", "<All>" FROM tblState ORDER BY tblState.StateLong;
The bound column is "1". This combo box is linked to a subform by idnStateID that displays cases from tblcases with a foreign key of idnStateID.
Each time I select <All>, the subform only shows cases from the state of Alabama, which is idnStateID "1".
I also have the following code behind the form in VBA:
Private Sub cmdClearFilter_Click()
Me.FilterOn = False
End Sub
Private Sub Form_AfterUpdate()
Dim strMyData As String
Dim strMyFilter As String
strMyData = Me![Combo9]
strMyFilter = "[idnStateID] = '" & strMyData & "'"
Me.DataEntry = False
Me.Filter = strMyFilter
Me.FilterOn = True
End Sub
Private Sub Form_Close()
Me.Filter = vb
End Sub
Private Sub Combo9_AfterUpdate()
If Nz(Me!Combo9, "*") = "*" Then
Me.FilterOn = False
Else
Me.Filter = "idnStateID=" & Me!Combo9
Me.FilterOn = True
End If
End Sub
Private Sub Form_Open(Cancel As Integer)
DoCmd.Maximize
End Sub
Private Sub Form_Unload(Cancel As Integer)
Me.Filter = vbNullString
Me.FilterOn = False
Me.DataEntry = True
End Sub
I would truly appreciate any help on this. My deadline is Friday.
Thanks in advance. Sahaitu
I have scoured the internet and gotten several useful tips from the experts here, though, I still have the same problem.
I have a form with a combo box with a rowsource connected to tblState which is a simple state lookup table. The rowsource is as follows:
SELECT tblState.idnStateID, tblState.StateLong FROM tblState UNION SELECT "*", "<All>" FROM tblState ORDER BY tblState.StateLong;
The bound column is "1". This combo box is linked to a subform by idnStateID that displays cases from tblcases with a foreign key of idnStateID.
Each time I select <All>, the subform only shows cases from the state of Alabama, which is idnStateID "1".
I also have the following code behind the form in VBA:
Private Sub cmdClearFilter_Click()
Me.FilterOn = False
End Sub
Private Sub Form_AfterUpdate()
Dim strMyData As String
Dim strMyFilter As String
strMyData = Me![Combo9]
strMyFilter = "[idnStateID] = '" & strMyData & "'"
Me.DataEntry = False
Me.Filter = strMyFilter
Me.FilterOn = True
End Sub
Private Sub Form_Close()
Me.Filter = vb
End Sub
Private Sub Combo9_AfterUpdate()
If Nz(Me!Combo9, "*") = "*" Then
Me.FilterOn = False
Else
Me.Filter = "idnStateID=" & Me!Combo9
Me.FilterOn = True
End If
End Sub
Private Sub Form_Open(Cancel As Integer)
DoCmd.Maximize
End Sub
Private Sub Form_Unload(Cancel As Integer)
Me.Filter = vbNullString
Me.FilterOn = False
Me.DataEntry = True
End Sub
I would truly appreciate any help on this. My deadline is Friday.
Thanks in advance. Sahaitu