Results 1 to 2 of 2
  1. #1
    np1111 is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2010
    Posts
    10

    Comparing form field with the field from database

    Hello.

    I have another problem with access. I would like that one of my buttons will check before he saves my fields into the database if in the database already exist this field. I add a condition to button:


    Code:
    IIf(([Forms]![ZNC]![C_1])=([dbo_KRT]![C]);1;2)
    and if it is correct prompt by window with error.
    I think that it didn't check if the field exist in the database.

    This isn't work!! please help

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    The simplest method is probably a DCount:

    If DCount(...) > 0 Then

    more info on the syntax here:

    DLookup Usage Samples
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 0
    Last Post: 03-03-2010, 08:24 PM
  2. Autofill field based on autonumber field
    By frevilla in forum Forms
    Replies: 1
    Last Post: 09-11-2009, 02:50 AM
  3. Replies: 1
    Last Post: 05-20-2009, 09:09 AM
  4. Replies: 1
    Last Post: 02-26-2009, 11:31 AM
  5. Quick way to stuff field names into text field
    By kfinpgh in forum Programming
    Replies: 0
    Last Post: 01-04-2007, 01:13 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