Results 1 to 5 of 5
  1. #1
    cbende2's Avatar
    cbende2 is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jun 2014
    Location
    Louisiana
    Posts
    370

    Question Help on Report

    Hello all!



    I'm having difficulty creating a report.

    Let's assume I have 5 records with 5 fields.

    record1, record2, record3, record4, record5, and field1(primaryKey), field2, field3, field4, field5.

    Not every field has data in it(meaning it is either null or blank).

    I would like for a report to display the field1(primaryKey) field, and any other field that is blank or null in that record.

    Code:
    I was thinking about putting 5 unbound textboxes(TextBox1, TextBox2, TextBox3....) on a report and putting some code that does the following:
    
    If field1 is not null 
    Then go to next field
    Else 
    TextBox1 = field1
    
    this code would need to loop through each field and also increase textbox number after a textbox is assigned a certain fieldname
    Any ideas??

    Also, my database is normalized, the reason why some fields are blank is simply because we are tracking a process that is over a period of time. Therefore some fields are filled out way before others.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725
    you could try using this as the record source of your report. (untested)
    I believe you want to display the PK for the records with some empty field(s)
    Code:
    Select ID,your field list from yourTable 
    where
    len(field1 & "") = 0 or
    len(field2 & "") = 0 or
    len(field3 & "") = 0 or
    len(field4 & "") = 0 or
    len(field5 & "") = 0 ;

  3. #3
    cbende2's Avatar
    cbende2 is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jun 2014
    Location
    Louisiana
    Posts
    370
    Quote Originally Posted by orange View Post
    I believe you want to display the PK for the records with some empty field(s)
    Yes! That's exactly what I would like!

    For the SQL you gave me, is that assigning unbound textboxes with the field? I don't understand how that query accomplishes what I'm asking.

    I'm still a newcomer when it comes to SQL and VBA.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725
    Use the report wizard with that query. It should build a report at least a starting point.

    Why do you want a report--what about just running the query and see what results?

  5. #5
    cbende2's Avatar
    cbende2 is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jun 2014
    Location
    Louisiana
    Posts
    370
    My boss would like for only the fields that are null to display for each individual record.

    I'm just trying to make the man happy ya know!
    Last edited by cbende2; 02-16-2015 at 04:18 PM.

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

Similar Threads

  1. Replies: 3
    Last Post: 03-11-2013, 05:11 PM

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