Re: ID mixing with all records

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Nick

You've described the "how" ... now, how 'bout the "what". Since queries and
forms and reports are all based on the underlying data, please describe your
table structure and data types.

--
Regards

Jeff Boyce
Microsoft Office/Access MVP
http://mvp.support.microsoft.com/

Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

Microsoft Registered Partner
https://partner.microsoft.com/

"Nick X" <Nicknnator (no) @ (spam) aol.123com> wrote in message
news:7D4C56E1-06B8-4C4A-AC2E-F5BD6B00169A@xxxxxxxxxxxxxxxx
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


.



Relevant Pages

  • Re: ID mixing with all records
    ... Private Sub Form_Current ... Microsoft IT Academy Program Mentor ... I am having an issue with my form when I apply a filter. ... If chkAllUT = True Then ...
    (microsoft.public.access.forms)
  • Re: How to enforce subtypes/supertypes in Access 2000?
    ... why do you prefer DAO over ADO? ... because Microsoft does not plan to provide any future enhancements for the ... Private Sub SetContactType() ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Form_Open cancelled "delayed" !?
    ... I believe that this is due to the fact that Microsoft has tried to make the ... Private Sub Form_Open ... MsgBox "Can't use this form now - Open canceled" ... cancel is set to true. ...
    (microsoft.public.access.formscoding)
  • Re: Track changes
    ... when opening or saving" on the Security tab of Tools | Options. ... Microsoft provides this macro code "as is" without ... > Private Sub AddinInstance_OnConnection(ByVal Application As Object, ... > | Thread-Topic: Track changes ...
    (microsoft.public.word.newusers)
  • RE: Need Code Help - Docmd. problem
    ... Microsoft Access Support ... | Dim strFoundFile As String ... | Private Sub lst_FilesInDirectory_Click ...
    (microsoft.public.access.macros)