Record look up and Max number set (1 Viewer)

cliffsimms

Registered User.
Local time
Today, 04:33
Joined
Sep 28, 2000
Messages
18
am building a database for the first time with Access2000.

1) I would like to have a command button that would allow someone to type there name to locate their information, if they are not listed I would like a message to pop up that would tell them that they would need to enter their information on a different form which is already built.
I do not want to use the basic find record command button though. I have this mush of code done but it has a bug in it.

Option Compare Database
Option Explicit
Function OpenFormWithInput()
Dim Msg As String
Dim Title As String
Dim Defvalue As String
Dim Answer As String

Msg = "Enter Student Name"
Title = "OPEN CUSTOMERS FORM"
Defvalue = ""
Answer = InputBox(Msg, Title, Defvalue)
If Answer <> "" Then
DoCmd.OpenForm "frmStudent", , , "[NameID]='" & Answer & "' "
Else
DoCmd.OpenForm "frmstudent"
End If
End Function

Everything runs fine until this point and than I get a run error 2502 open form command has been canceled.

2) I would like to set a max number of seats available and have the seats subtract automatically as people register for a class. So when the next person try's to enter the same date for a class they will see that there are 10 or 9 seats left and so on.

3) I would like to have the of a class gray out and make it so that a person is unable to select it if the date has already past or the seats are filled.
 

MHM

Registered User.
Local time
Today, 04:33
Joined
Mar 15, 2000
Messages
101
You need to change the LinkCriteria, because - I assume - [NameID] is not text, but number.

Do this:

DoCmd.OpenForm "frmStudent", , , "[NameID]=" & CLng(Answer)
 

cliffsimms

Registered User.
Local time
Today, 04:33
Joined
Sep 28, 2000
Messages
18
Thanks got it working
 

Users who are viewing this thread

Top Bottom