Results 1 to 5 of 5
  1. #1
    Iain is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2012
    Location
    Aberdeenshire, Scotland
    Posts
    42

    Find the first record in form's source table where a specified field is null


    I wish to write some code that will:

    - search the form's table when the form is opened;
    - find the first record in the table where a specified field is empty, then;
    - populate a set of text boxes with the data from each of the fields in the record

    I am guessing that this can be achieved with a SELECT statment in one of the form's property boxes but I'm unsure which property box to use and how to construct the statment.

    Can anybody suggest how I might go about this?

  2. #2
    Iain is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2012
    Location
    Aberdeenshire, Scotland
    Posts
    42
    Only Idea I have at the moment is something like:

    Code:
    Dim Rst As recordSet
    
      Dim f As Field
      
      'Current Record set
      Set Rst = CurrentDb.OpenRecordset("tblWebMeetingData")
      
      'Holds current fields data
      Dim fieldData
      
      'With Rst
          'Do Until Rst.EOF
             For Each f In Rst.Fields
                  If IsNull(f.Value) Then
                      MsgBox ("Field Name: " & f.Name)
                  End If
             Next
          'Loop
      'End With
      
      Rst.Close

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Could open recordset object with SQL using TOP N parameter.
    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.

  4. #4
    Iain is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2012
    Location
    Aberdeenshire, Scotland
    Posts
    42
    Quote Originally Posted by June7 View Post
    Could open recordset object with SQL using TOP N parameter.
    Are you refering to the code I posted?
    What is a TOP N parameter?

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    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.

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

Similar Threads

  1. Replies: 1
    Last Post: 06-06-2014, 06:32 AM
  2. form - record source - select a table
    By johnseito in forum Access
    Replies: 13
    Last Post: 11-15-2013, 02:54 PM
  3. Replies: 5
    Last Post: 11-12-2013, 12:14 AM
  4. Replies: 14
    Last Post: 05-25-2012, 02:40 AM
  5. Replies: 3
    Last Post: 01-15-2011, 02:39 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