N
Nick X
Hi all,
I am having an issue with my form when I apply a filter. The filter is
working as expected, until you look at the KeyID or the UtilityAlias (Company
Name). The problem is that when you run this code:
Private Sub cboStreetNames_AfterUpdate()
' Find the record that matches the control.
On Error GoTo cboStreetNames_AfterUpdate_Err
If chkAllUT = True Then
DoCmd.ShowAllRecords
Me.cboStreetNames.Requery
DoCmd.ApplyFilter "qSearchStreet"
Me.cboStreetNames.Requery
Else
DoCmd.ShowAllRecords
Me.cboStreetNames.Requery
DoCmd.ApplyFilter "qSearchStreet", "JobID = " & Me.JobID
Me.cboStreetNames.Requery
End If
cboStreetNames = ""
chkAllUT = False
DoCmd.GoToControl "cboStreetNames"
cboStreetNames_AfterUpdate_Exit:
Exit Sub
cboStreetNames_AfterUpdate_Err:
MsgBox Error$
Resume cboStreetNames_AfterUpdate_Exit
End Sub
If chkAllUT = True then it should show everything, which it does, but with
the wrong KeyID.
This is where I kinda suspect the problem to be:
Private Sub Form_Current()
If Not IsNull(Me.OpenArgs) Then
Me.JobID = Me.OpenArgs
End If
....
But when I remove this code it still does the same thing.
my combo box filters against several fields:
SELECT tblCuts.Address1, tblCuts.StreetName, tblCuts.From, tblCuts.To,
tblUtilities.UtilityAlias, tblCuts.JobID, *
FROM tblUtilities INNER JOIN tblCuts ON tblUtilities.KeyID = tblCuts.JobID
WHERE ((([Forms].[fCuts].[cboStreetNames]) Is Null)) OR (((tblCuts.Address1)
Like "*" & [Forms].[fCuts].[cboStreetNames] & "*")) OR (((tblCuts.StreetName)
Like "*" & [Forms].[fCuts].[cboStreetNames] & "*")) OR (((tblCuts.From) Like
"*" & [Forms].[fCuts].[cboStreetNames] & "*")) OR (((tblCuts.To) Like "*" &
[Forms].[fCuts].[cboStreetNames] & "*"))
ORDER BY tblCuts.DateCalled DESC;
Sorry, a lot to take in.
Please help
Thanks,
NickX
I am having an issue with my form when I apply a filter. The filter is
working as expected, until you look at the KeyID or the UtilityAlias (Company
Name). The problem is that when you run this code:
Private Sub cboStreetNames_AfterUpdate()
' Find the record that matches the control.
On Error GoTo cboStreetNames_AfterUpdate_Err
If chkAllUT = True Then
DoCmd.ShowAllRecords
Me.cboStreetNames.Requery
DoCmd.ApplyFilter "qSearchStreet"
Me.cboStreetNames.Requery
Else
DoCmd.ShowAllRecords
Me.cboStreetNames.Requery
DoCmd.ApplyFilter "qSearchStreet", "JobID = " & Me.JobID
Me.cboStreetNames.Requery
End If
cboStreetNames = ""
chkAllUT = False
DoCmd.GoToControl "cboStreetNames"
cboStreetNames_AfterUpdate_Exit:
Exit Sub
cboStreetNames_AfterUpdate_Err:
MsgBox Error$
Resume cboStreetNames_AfterUpdate_Exit
End Sub
If chkAllUT = True then it should show everything, which it does, but with
the wrong KeyID.
This is where I kinda suspect the problem to be:
Private Sub Form_Current()
If Not IsNull(Me.OpenArgs) Then
Me.JobID = Me.OpenArgs
End If
....
But when I remove this code it still does the same thing.
my combo box filters against several fields:
SELECT tblCuts.Address1, tblCuts.StreetName, tblCuts.From, tblCuts.To,
tblUtilities.UtilityAlias, tblCuts.JobID, *
FROM tblUtilities INNER JOIN tblCuts ON tblUtilities.KeyID = tblCuts.JobID
WHERE ((([Forms].[fCuts].[cboStreetNames]) Is Null)) OR (((tblCuts.Address1)
Like "*" & [Forms].[fCuts].[cboStreetNames] & "*")) OR (((tblCuts.StreetName)
Like "*" & [Forms].[fCuts].[cboStreetNames] & "*")) OR (((tblCuts.From) Like
"*" & [Forms].[fCuts].[cboStreetNames] & "*")) OR (((tblCuts.To) Like "*" &
[Forms].[fCuts].[cboStreetNames] & "*"))
ORDER BY tblCuts.DateCalled DESC;
Sorry, a lot to take in.
Please help
Thanks,
NickX