Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2002

    Question Unanswered: [Access97] Automatic message if record already exists

    (My English isn't VERY good, I hope you forgive my mistakes)

    I have build a database, but now I want to add more functionality. The question is one of them. In a form there is textfield for input, input that is saved into a certain record in a table. This record is called "configuratienummer" (without quotes).

    There is for example already an "H001" as configuratienummer existing, in the textfield I would want a realtime check if it exists, as soon as I type H001 I will need to get the message "Already exists" instead of pressing enter and then the error message, following with an OK button or some sort.

    Please mind, I am a access-newbie and I do not know VBA (yet)

    Thanks in advance for your time

  2. #2
    Join Date
    Oct 2002
    Leicester - UK
    This record is called "configuratienummer" (without quotes).

    do you mean record or table?
    if you mean table i think i can under stand what your trying to do
    how i see it is that you get an error when you append a already excisting name to the table,

    now i see too possible solutions 1 easy 1 hard
    suppress the error
    docmd.setwarning false
    <run query>
    docmd.setwarning true

    the method you've suggested
    firstly enter the VBA editior goto tool --> references and ensure that microsoft DAO 3.6 is ticked

    then add this code to the txtboxes after update event

    Dim Cur_DB As DAO.Database, Record_Set As DAO.Recordset
    Set Cur_DB = CurrentDb
    Set Record_Set = Cur_DB.OpenRecordset("select * from configuratienummer where <fieldname> = ;")
    If Record_Set.RecordCount <> 0 Then MsgBox "Already exists"

    you may need to covert some of this into the native langueage you using (i'd say german from the table name)
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts