DCount using criteria from Form field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sophie Mess
    New Member
    • Jan 2011
    • 17

    DCount using criteria from Form field

    Hi,

    I am looking to use DCount to see if a value (Student ID) is already in the back end table, by getting DCount to return the value of times (if at all) the student ID appears in the table.

    I've tried coding it in several different ways but none seem to work... thus I was wondering if anyone had any tips?

    Back end table: Student Options
    Table Field: Student ID
    Form Name: Option Form
    Form field name: StudentID

    The value i'm searching for/using look like: A762939

    Code:
    'studentused = DCount("[Student ID]", "Student Options", "[StudentID] = '" & Me.StudentID & "'")
    any suggestions would be great, the aim of this is to stop anyone adding another record if they've already added one!

    Also how could i code it that if a user had previously entered a record they could chose to amend it at a later date?

    Thanks
    Last edited by Niheel; Jan 18 '11, 04:55 AM. Reason: merged question
Working...