G
Guest
Hello,
I have an unbound combo box on a form that also has a list box. I want the
list box to populate with only those records that match selection from combo
box (a text field). I've done this before in another db and have copied and
pasted the code to this db, but can't get it to work. I've gotten errors and
have changed it around so much that I'm not sure where to go with it now. I
don't get the error messages but it doesn't return anything either.
Will someone please let me know what I'm doing wrong? I've included the
code from both below.
Private Sub CboFluid_AfterUpdate()
Dim strSQL As String
strSQL = "SELECT qCompiledList.[SeparateSN],
qCompiledList.[OriginalCustomer], qCompiledList.[City],
qCompiledList.[State], qCompiledList.[Model], qCompiledList.[Fluid],
qCompiledList.[FluidListedBySundyne]" & _
"FROM qCompiledList " & _
"WHERE qCompiledList.[Fluid] = '" & Me.CboFluid & "'" & _
"Or qCompiledList.[FluidListedBySundyne] = '" & Me.CboFluid & "';"
Me.RecordSource = strSQL
End Sub
rivate Sub Form_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Fluid] = '" &
Str(Nz(Forms!Form1!fCompiledListSubform.Form!Fluid, 0)) & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
Any help is greatly appreciated!
Thanks in advance,
Pam
I have an unbound combo box on a form that also has a list box. I want the
list box to populate with only those records that match selection from combo
box (a text field). I've done this before in another db and have copied and
pasted the code to this db, but can't get it to work. I've gotten errors and
have changed it around so much that I'm not sure where to go with it now. I
don't get the error messages but it doesn't return anything either.
Will someone please let me know what I'm doing wrong? I've included the
code from both below.
Private Sub CboFluid_AfterUpdate()
Dim strSQL As String
strSQL = "SELECT qCompiledList.[SeparateSN],
qCompiledList.[OriginalCustomer], qCompiledList.[City],
qCompiledList.[State], qCompiledList.[Model], qCompiledList.[Fluid],
qCompiledList.[FluidListedBySundyne]" & _
"FROM qCompiledList " & _
"WHERE qCompiledList.[Fluid] = '" & Me.CboFluid & "'" & _
"Or qCompiledList.[FluidListedBySundyne] = '" & Me.CboFluid & "';"
Me.RecordSource = strSQL
End Sub
rivate Sub Form_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Fluid] = '" &
Str(Nz(Forms!Form1!fCompiledListSubform.Form!Fluid, 0)) & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
Any help is greatly appreciated!
Thanks in advance,
Pam