Results 1 to 3 of 3
  1. #1
    rdkelly3 is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2011
    Location
    Greenville, SC
    Posts
    2

    Loop Subform to find null fields

    I am having great difficulty in figuring out how to code this properly. basically, what I want to do is at the final stage of receiving a purchase order, the final country of origin needs to be completed (field named [COO]). FYI, we might not know what country the products are coming from at the time of initial issue of said purchase order. My latest variation of code is:

    Dim tmprs As Variant
    Set tmprs = [PO_Detail subform].Form.Recordset
    If Not tmprs.BOF Then
    tmprs.MoveFirst
    End If
    If IsNull(Me.PO_Detail_subform![COO]) Then


    With Me.PO_Detail_subform.Form.Recordset
    Do While Not .EOF
    MsgBox ("COO")
    .MoveNext
    Loop
    End With
    End If

    Any suggestions would be greatly appreciated.

    Thanks,
    Robert

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    You could filter the subform to only include the nulls

    Me.PO_Detail_subform.form.filteron = false
    Me.PO_Detail_subform.form.filter = ""
    Me.PO_Detail_subform.form.filter = "[COO] is null"
    Me.PO_Detail_subform.form.filteron = True

    My preference is to not use the filter but instead adjust the recordsource of the form. Filters may be adjusted by the user and provide inconsistent results. You could include a WHERE clause that would have the child link field as well as COO

  3. #3
    rdkelly3 is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2011
    Location
    Greenville, SC
    Posts
    2
    Thanks for your response, I will give it a try.
    Thanks Again,
    Robert

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

Similar Threads

  1. How to update subform records using loop
    By tahirsatti in forum Forms
    Replies: 15
    Last Post: 05-13-2013, 01:22 AM
  2. Sum fields in subform if not Null
    By atom in forum Forms
    Replies: 6
    Last Post: 02-10-2012, 04:03 PM
  3. Loop through subform records
    By asmith in forum Forms
    Replies: 6
    Last Post: 10-06-2010, 10:31 AM
  4. Replies: 9
    Last Post: 04-28-2010, 11:20 AM
  5. Replies: 5
    Last Post: 03-20-2010, 08: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