|
-
Jun 4th, 2003, 02:20 PM
#1
Thread Starter
Lively Member
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
-
Jun 5th, 2003, 06:52 AM
#2
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
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|