Results 1 to 2 of 2

Thread: New here ... Need a little help

  1. #1

    Thread Starter
    Lively Member imperial07's Avatar
    Join Date
    Mar 2001
    Location
    Illinois
    Posts
    75

    New here ... Need a little help

    I dont do much work in databases, so I need a little help. I am working in Access and creating a form. I am having a user enter a name and a date, I want to check that against my table to make sure that name and date dont already exist.

    I have my If statement and loop already written, but when I try ti run it I get this message:

    db1 can't find the field '|' referred to in your expression.

    Here is the code that I have:

    Public Sub error_check()

    x = [Homework_Club].[ID]

    For i = 1 To x
    If [Homework_Club.Student_Name] = Text1 And [Homework_Club.Date = Text22] Then
    MsgBox "Student has already been entered for that date", vbCritical, "Error"
    End If
    Next i

    End Sub

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343
    What??


    I think you need to read some tutorials.

    You need to:
    1) Validate the data entered
    2) Open a recordset using the data as a filter (where clause)
    3) If no record exists, create one, saving the data
    - If records exist, tell the user
    4) close recordset
    5) clean up


    Vince

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

Posting Permissions

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



Click Here to Expand Forum to Full Width