Results 1 to 12 of 12
  1. #1
    jamo is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    20

    show companies with null values

    I have created a form, I need this form to enter amounts and date paid after the companies have paid. I have this code that is filtered by company, it shows amount due. I have this code but the form does bot show any data. I need to show data for those companies in arrears.


    Code:
     Private Sub CboFilter_Change()
    'If the combo box is cleared, clear the form filter.
      If Nz(Me.CboFilter.Value) = "" Then
        Me.Form.Filter = ""
        Me.FilterOn = False
    
      ' If a combo box item is selected, filter for an exact match.
      ' Use the ListIndex property to check if the value is an item in the list.
      ElseIf Me.CboFilter.ListIndex <> -1 Then
        Me.Form.Filter = "[Importer Name] = '" & Nz(Me.Amount_Paid.Value) = "" & _
                         Replace(Me.CboFilter.Value, "'", "''") & "'"
        Me.FilterOn = True
    
      ' If a partial value is typed, filter for a partial company name match.
      Else
    
        Me.Form.Filter = "[Importer Name] Like '*" & _
                         Replace(Me.CboFilter.Value, "'", "''") & "*'"
        Me.FilterOn = False
    
      End If
    
      ' Move the cursor to the end of the combo box.
      Me.CboFilter.SetFocus
      Me.CboFilter.SelStart = Len(Me.CboFilter.Value)
    
    End Sub

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,921
    Why does the filter show criteria of [Importer Name] = [Amount_Paid]?

    Want to provide db for analysis? Follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    jamo is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    20
    Thanks I have uploaded a sample with the relevant data
    Attached Files Attached Files

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,921
    The form doesn't display existing records because the DataEntry property is set to Yes. This only allows new record entry.

    The form RecordSource does not include ImporterId nor ImporterName.

    Why use PurchasingExtended in the RecordSource? Just use the Purchasing table.

    SELECT Purchasing.*, Importer.ImporterID, Importer.[Importer Name], Payment.[Receipt NO], Payment.[Amount Paid], Payment.[Date Paid] FROM (Purchasing LEFT JOIN Payment ON Purchasing.PurchasingID = Payment.PurchasingID) LEFT JOIN Importer ON Purchasing.ImporterID = Importer.ImporterID;

    Better to filter on ImporterID instead of ImporterName.

    Advise not to use spaces, special characters, punctuation (underscore is exception) in names, nor reserved words as names.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    jamo is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    20
    thank you going to try

  6. #6
    jamo is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    20
    Thanks it works but how can I filter on only those where the receipt numbers are blank, I need those to be filled when the payments are made?

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,921
    Use WHERE clause:

    WHERE [Receipt NO] Is Null;
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    jamo is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    20
    I am reading the formula but I am do not know where to include the where clause

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,921
    Query in Design view.

    On the Criteria row under the [Receipt No] field: Is Null
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  10. #10
    jamo is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    20
    sorry for the slow response has some computer issue. I tried doing this but it does not work the query is coming up blank.

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,921
    It works for me:

    SELECT Purchasing.*, Importer.ImporterID, Importer.[Importer Name], Payment.[Receipt NO], Payment.[Amount Paid], Payment.[Date Paid]
    FROM (Purchasing LEFT JOIN Payment ON Purchasing.PurchasingID = Payment.PurchasingID) LEFT JOIN Importer ON Purchasing.ImporterID = Importer.ImporterID
    WHERE (((Payment.[Receipt NO]) Is Null));

    Did you change the DataEntry property? See post #4.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  12. #12
    jamo is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    20
    Thanks this works great. thanks

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Show when object field is null
    By Accesfreak in forum Queries
    Replies: 3
    Last Post: 10-26-2012, 08:49 AM
  2. IF ID Is not Null show TYPE from other table
    By superjeff in forum Access
    Replies: 5
    Last Post: 09-14-2012, 09:45 PM
  3. Finding the Max Date and Null Values if Null
    By SpdRacerX in forum Queries
    Replies: 1
    Last Post: 02-03-2012, 06:29 AM
  4. Do not show null records
    By brobb56 in forum Forms
    Replies: 1
    Last Post: 09-23-2011, 02:29 PM
  5. Replies: 2
    Last Post: 08-01-2011, 09:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums