D
Doctor
I am using the code below for a button in a form. It searches the Leaders
table to find all leaders who are directors. Then registers all of these
leaders for whichever event the button is in. However, when I press the
button, it does something that I don't understand. Right now I have two
events in my test database that I could register for. Both of them have about
12 people registered for them. I typed each of these registrants in. When I
create a third event to test my new nifty button, it seems like it takes the
first two events and doubles their registrations and register no one for the
third event??? For instance, in my third new event, I pressed the button,
then there were 24 registerd guests for events one and two. Then, if I
pressed it again, there were 48 registered guests in the first and second
event.
It doesn't make sense to me! What am I doing wrong. Any help would be
greatly appriciated.
Thanks,
Doc
Dim stSQL As String
Dim db As DAO.Database
stSQL = "INSERT INTO tblEventAttendance ( EventID, LeaderID )" _
& " SELECT tblEvent.EventID, tblLeaders.LeaderID" _
& " FROM (tblEvent INNER JOIN tblEventAttendance ON tblEvent.EventID =
tblEventAttendance.EventID) INNER JOIN tblLeaders ON
tblEventAttendance.LeaderID = tblLeaders.LeaderID" _
& " WHERE (((tblLeaders.LPosition1)=2))"
CurrentDb().Execute (stSQL)
table to find all leaders who are directors. Then registers all of these
leaders for whichever event the button is in. However, when I press the
button, it does something that I don't understand. Right now I have two
events in my test database that I could register for. Both of them have about
12 people registered for them. I typed each of these registrants in. When I
create a third event to test my new nifty button, it seems like it takes the
first two events and doubles their registrations and register no one for the
third event??? For instance, in my third new event, I pressed the button,
then there were 24 registerd guests for events one and two. Then, if I
pressed it again, there were 48 registered guests in the first and second
event.
It doesn't make sense to me! What am I doing wrong. Any help would be
greatly appriciated.
Thanks,
Doc
Dim stSQL As String
Dim db As DAO.Database
stSQL = "INSERT INTO tblEventAttendance ( EventID, LeaderID )" _
& " SELECT tblEvent.EventID, tblLeaders.LeaderID" _
& " FROM (tblEvent INNER JOIN tblEventAttendance ON tblEvent.EventID =
tblEventAttendance.EventID) INNER JOIN tblLeaders ON
tblEventAttendance.LeaderID = tblLeaders.LeaderID" _
& " WHERE (((tblLeaders.LPosition1)=2))"
CurrentDb().Execute (stSQL)