Results 1 to 2 of 2
  1. #1
    jtmott is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2013
    Posts
    17

    Check Table

    Hello I'm new to VBA programming. I have a table that i use a an append query to update. I would want to have some code that will check the table to see if the is an entry. I am using IsNull & IsEmpty but it's not working. the code I'm using is below. Any help would be appreciated.

    DoCmd.OpenQuery "Qry Append Temp Supervisor", acViewNormal, acEdit
    If IsNull("Temp_Supervisor.INCODE") Or "Temp_Supervisor.INCODE" = "" Then
    MsgBox "Invalid Supervisor", vbRetryCancel Or vbCritical


    SupHandler1
    Else
    DoCmd.OpenQuery "Qry Update Part Match Sup", acViewNormal, acEdit
    DoCmd.OpenQuery "Qry Delete Temp Supervisor", acViewNormal, acEdit

    End If

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    1 you would not put the warning in the query,
    it would go on the form before the user saves it.

    2. if you want to check in the query, you would bring up the list of invalid entries:

    Code:
    if dCount("*", "qsBadData")> 0 then
      docmd.openquery "qsBadData"         'where qsBadData = "select * from table where IsNull(INCODE) or Incode = "")
    else
           DoCmd.OpenQuery "Qry Update Part Match Sup", acViewNormal, acEdit
            DoCmd.OpenQuery "Qry Delete Temp Supervisor", acViewNormal, acEdit
    endif

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

Similar Threads

  1. Creating a From from a Table for a check box
    By Lou_Reed in forum Access
    Replies: 3
    Last Post: 12-29-2015, 12:01 PM
  2. How to check for sure that a table is a validation table?
    By magnusstefan in forum Database Design
    Replies: 23
    Last Post: 11-02-2015, 02:15 AM
  3. check table, if exist then update another table
    By JeroenMioch in forum Programming
    Replies: 6
    Last Post: 07-06-2012, 09:12 AM
  4. check a value on a table
    By udik in forum Programming
    Replies: 2
    Last Post: 12-05-2011, 03:57 AM
  5. how do i check against a table?
    By cheeese in forum Queries
    Replies: 1
    Last Post: 03-19-2011, 11:09 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