Results 1 to 5 of 5
  1. #1
    BatmanMR287 is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Jan 2014
    Posts
    69

    Stop query on null value.

    I have an append query that needs to stop if nothing is entered in the date field. What criteria should I use. Will is stop the query and continue?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    In what date field - do you mean a control on form? Are you running an Access query object? I only run action queries in VBA, like:

    If Not IsNull(Me.control3) Then
    CurrentDb.Execute "INSERT INTO tablename(field1, field2, field3) VALUES(" & Me.control1 & ", '" & Me.control2 & "', #" & Me.control3 & "#")
    End If
    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
    BatmanMR287 is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Jan 2014
    Posts
    69
    I have a form that saves selected and imputted data into a temp table. Then an append query transfers the data into a main table. The user inputs date and a short note.
    The button that activates the query can be pushed without a date entered and puts partial data into table. I want the query to stop if no date is put in.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Use conditional code like my example.

    Or set the button as disabled and code will enable it only if valid date entered.
    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
    BatmanMR287 is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Jan 2014
    Posts
    69
    I got it. Just had to put Is Not Null in the criteria field on the query.

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

Similar Threads

  1. Replies: 3
    Last Post: 08-19-2013, 01:23 PM
  2. Query to stop rounding off currency
    By Ruegen in forum Queries
    Replies: 4
    Last Post: 07-24-2013, 09:49 AM
  3. Replies: 1
    Last Post: 02-23-2012, 02:27 PM
  4. Replies: 1
    Last Post: 07-07-2011, 08:32 PM
  5. Replies: 2
    Last Post: 11-29-2009, 12:00 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