J
Jonathan Brown
I have a many to many relationship between security clearances and billets.
a clearance can be associated with more than one billet and a single billet
can be associated with many clearances. That; however, may not have anything
to do with my problem.
I've built a form that has a listbox that displays the assocaited billets
for an employee's clearance. Next to it I put a drop down list box that
looks up the list of billets and stores it's value for later use. I've then
added an "add" button underneath the drop down list box. What i'd like to do
is choose a given billet from my drop down list box and then click add. It
should create a new record in my junction table with the value of the drop
down list box in the billet field.
I can't figure out the code behind my add button. I'm sure the sql
statement should be something like:
"INSERT INTO tblbilletjoin (clearancenum, billetnum) SELECT
tblBilletJoin.ClearanceNum, tblBilletsjoin.BilletNum From tblBilletsJoin
Where (((tblBilletsJoin.ClearanceNum)=[forms]![frmClearance]![ClearanceNum])
AND ((tblBilletsJoin.BilletNum)=[forms]![frmClearance]![cboBillet]));"
But I don't remember what the command is to run that sql statement. Do I
have to open a new recordsource? And then is it just me.recordsource.add
("sql statement")?
I might be totally confusing myself. I don't know.
a clearance can be associated with more than one billet and a single billet
can be associated with many clearances. That; however, may not have anything
to do with my problem.
I've built a form that has a listbox that displays the assocaited billets
for an employee's clearance. Next to it I put a drop down list box that
looks up the list of billets and stores it's value for later use. I've then
added an "add" button underneath the drop down list box. What i'd like to do
is choose a given billet from my drop down list box and then click add. It
should create a new record in my junction table with the value of the drop
down list box in the billet field.
I can't figure out the code behind my add button. I'm sure the sql
statement should be something like:
"INSERT INTO tblbilletjoin (clearancenum, billetnum) SELECT
tblBilletJoin.ClearanceNum, tblBilletsjoin.BilletNum From tblBilletsJoin
Where (((tblBilletsJoin.ClearanceNum)=[forms]![frmClearance]![ClearanceNum])
AND ((tblBilletsJoin.BilletNum)=[forms]![frmClearance]![cboBillet]));"
But I don't remember what the command is to run that sql statement. Do I
have to open a new recordsource? And then is it just me.recordsource.add
("sql statement")?
I might be totally confusing myself. I don't know.