N
Nike
I have a sign-in form which the customers enter
information then pick a reason/class for their visit. If
they have been already registered into the class and are
now signing in to attend then it updates the field Attend
to "Yes' in the tblStudentsAndClasses table. Otherwise if
they are not registered then I have a msg box pop up
telling them they are not registered and to see a staff
member.
I have everything working up to this point, but now I want
to be able to allow them to register in specific classes
if they wish. This form only shows the classes being
taught that day and a couple other reasons they can choose
for their visit. The Reasonlist is drawn from a union
query which shows only a couple items along with the
classes being taught that day.
Can someone tell me how to update these 2 tables
(tblScheduleClass and tblStudentsAndClasses) that are not
really on the form?
tblReason
ReasonID PK
Reason
tblScheduleClass
ScheduleClassID PK
Class FK but excludes certain items
Date
StartTime
End Time
Room
Seats
Filled
tblStudentsAndClasses
StudentClassID
ClassID FK
CustomerID FK
Attend
etc
Here is some of my code:
Private Sub REASONLIST_Change()
Dim dbs As Database
Dim rst As Recordset
Dim rst2 As Recordset
If Me!REASONLIST.Column(1) = "Taping" Then
Me.DateofBirth.Visible = True
Me.DOB.Visible = True
Me.GENDER.Visible = True
Else
Me.DateofBirth.Visible = False
Me.DOB.Visible = False
Me.GENDER.Visible = False
End If
If Me!REASONLIST.Column(1) <> "taping" And Me!
REASONLIST.Column(1) <> "ergo" And Me!REASONLIST.Column(1)
<> "fam" Then
If Me!REASONLIST.Column(1) = "Fam Training" And DCount
("[StudentClassID]", "qryreasonSignIn") = "1" Then
Set dbs = CurrentDb
Set rst = OpenForSeek("tblFAM")
rst.Index = "CustomerID"
rst.Seek "=", Me.CustomerID
If Not rst.NoMatch Then
rst.Edit
rst![FAM] = True
rst![FAM_active] = True
rst![Certification] = Date
rst.Update
rst.Close
Else
End If
ElseIf DCount("[StudentClassID]", "qryreasonSignIn")
= "1" Then
Else
MsgBox "You are not registered for this class, do you
want to register?", vbYesNo, "IS YOUR SELECTION CORRECT?"
If vbYes Then
THIS PART FORWARD IS WHERE I AM HAVING PROBLEMS
Set rst = dbs.OpenRecordset("qryreasonsignin")
rst.AddNew
rst![SSAN] = vSSAN
rst("Filled") = ("Filled") + 1
rst.Update
rst.Close
Else
Me.REASONLIST = Null
End If
End If
End If
the SQL for qryreasonsSignIn is
SELECT tblStudentsAndClasses.StudentClassID,
tblStudentsAndClasses.ClassID, tblStudentsAndClasses.SSAN,
tblScheduleClass.Class, tblScheduleClass.Date,
tblScheduleClass.StartTime, tblScheduleClass.EndTime,
tblScheduleClass.Room, tblScheduleClass.Size,
tblScheduleClass.Filled, tblStudentsAndClasses.Attend
FROM tblScheduleClass RIGHT JOIN tblStudentsAndClasses ON
tblScheduleClass.ScheduleClassID =
tblStudentsAndClasses.ClassID
WHERE (((tblStudentsAndClasses.CustomerID)=[forms]!
[frmSignin].[CustomerID])AND ((tblScheduleClass.Class)=
[forms]![frmSignin].[reasonlist]) AND
((tblScheduleClass.Date)=Date()));
Thanks a bunch
information then pick a reason/class for their visit. If
they have been already registered into the class and are
now signing in to attend then it updates the field Attend
to "Yes' in the tblStudentsAndClasses table. Otherwise if
they are not registered then I have a msg box pop up
telling them they are not registered and to see a staff
member.
I have everything working up to this point, but now I want
to be able to allow them to register in specific classes
if they wish. This form only shows the classes being
taught that day and a couple other reasons they can choose
for their visit. The Reasonlist is drawn from a union
query which shows only a couple items along with the
classes being taught that day.
Can someone tell me how to update these 2 tables
(tblScheduleClass and tblStudentsAndClasses) that are not
really on the form?
tblReason
ReasonID PK
Reason
tblScheduleClass
ScheduleClassID PK
Class FK but excludes certain items
Date
StartTime
End Time
Room
Seats
Filled
tblStudentsAndClasses
StudentClassID
ClassID FK
CustomerID FK
Attend
etc
Here is some of my code:
Private Sub REASONLIST_Change()
Dim dbs As Database
Dim rst As Recordset
Dim rst2 As Recordset
If Me!REASONLIST.Column(1) = "Taping" Then
Me.DateofBirth.Visible = True
Me.DOB.Visible = True
Me.GENDER.Visible = True
Else
Me.DateofBirth.Visible = False
Me.DOB.Visible = False
Me.GENDER.Visible = False
End If
If Me!REASONLIST.Column(1) <> "taping" And Me!
REASONLIST.Column(1) <> "ergo" And Me!REASONLIST.Column(1)
<> "fam" Then
If Me!REASONLIST.Column(1) = "Fam Training" And DCount
("[StudentClassID]", "qryreasonSignIn") = "1" Then
Set dbs = CurrentDb
Set rst = OpenForSeek("tblFAM")
rst.Index = "CustomerID"
rst.Seek "=", Me.CustomerID
If Not rst.NoMatch Then
rst.Edit
rst![FAM] = True
rst![FAM_active] = True
rst![Certification] = Date
rst.Update
rst.Close
Else
End If
ElseIf DCount("[StudentClassID]", "qryreasonSignIn")
= "1" Then
Else
MsgBox "You are not registered for this class, do you
want to register?", vbYesNo, "IS YOUR SELECTION CORRECT?"
If vbYes Then
THIS PART FORWARD IS WHERE I AM HAVING PROBLEMS
Set rst = dbs.OpenRecordset("qryreasonsignin")
rst.AddNew
rst![SSAN] = vSSAN
rst("Filled") = ("Filled") + 1
rst.Update
rst.Close
Else
Me.REASONLIST = Null
End If
End If
End If
the SQL for qryreasonsSignIn is
SELECT tblStudentsAndClasses.StudentClassID,
tblStudentsAndClasses.ClassID, tblStudentsAndClasses.SSAN,
tblScheduleClass.Class, tblScheduleClass.Date,
tblScheduleClass.StartTime, tblScheduleClass.EndTime,
tblScheduleClass.Room, tblScheduleClass.Size,
tblScheduleClass.Filled, tblStudentsAndClasses.Attend
FROM tblScheduleClass RIGHT JOIN tblStudentsAndClasses ON
tblScheduleClass.ScheduleClassID =
tblStudentsAndClasses.ClassID
WHERE (((tblStudentsAndClasses.CustomerID)=[forms]!
[frmSignin].[CustomerID])AND ((tblScheduleClass.Class)=
[forms]![frmSignin].[reasonlist]) AND
((tblScheduleClass.Date)=Date()));
Thanks a bunch