Results 1 to 3 of 3
  1. #1
    taimysho0 is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Nov 2011
    Posts
    286

    Match TEXTBOX value with TABLE and then validate?

    i have a form where a user inputs values into the a textbox (one for customerID and DueDate) and if validations run and is good, the user presses a button and the information is added to a new table. However, the user cannot enter the same customerID for the same due date textboxes, how would i write and if/then statement for this validation? thanks so much



    here is a picture of what my form looks like:
    http://i130.photobucket.com/albums/p...rmeasytrak.jpg



  2. #2
    Toyman is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    233
    Quote Originally Posted by taimysho0 View Post
    i have a form where a user inputs values into the a textbox (one for customerID and ) and if validations run and is good, the user presses a button and the information is added to a new table. However, the user cannot enter the same customerID for the same due date textboxes, how would i write and if/then statement for this validation? thanks so much

    here is a picture of what my form looks like:
    http://i130.photobucket.com/albums/p...rmeasytrak.jpg

    You can use a DCount Function for this:

    Dim sCustomerID as Integer 'Assuming this is an number field
    Dim sDdate as Date

    sCustomerID = Me.CustomerID 'assigns the value from the text field to the veriable
    sDDate = Me.DueDate

    If DCount("*","YouTableName","[CustomerID] = " & sCustomerID & " And [DueDate] = #" & sDDate & "#") =0 Then 'No match found
    Do you stuff
    Else
    Do the other stuff
    End if

  3. #3
    taimysho0 is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Nov 2011
    Posts
    286
    thank you so much!

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

Similar Threads

  1. Replies: 3
    Last Post: 08-05-2011, 08:13 PM
  2. Searching for match in table
    By pdxengruser in forum Queries
    Replies: 1
    Last Post: 08-05-2011, 11:56 AM
  3. Replies: 13
    Last Post: 03-28-2011, 02:09 PM
  4. Replies: 1
    Last Post: 12-02-2010, 04:54 PM
  5. Match up table using only a few charecter?
    By bangemd in forum Queries
    Replies: 5
    Last Post: 06-05-2009, 04:15 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