I have a form to add a new member to an organization and I need to assign him to a committee. I have a form to create and edit the committees, they are assigned a committeeID which at the moment is 1 thru 6. So the committee table just has committeeID and committeeName. In the other form members are added, I have some fields for name, phone etc and a dropdown box which is populated with the committeeNames from the table named committee. When I add a new member all the info is updated to the committeemembers table except for the committeeID. I need the committeeID that corresponds to the committeeName that was selected from the dropdown box to be writen to he committeeID field in the committee table but it does not do that. This is what I have so far. This creates the dropdown populating it with the names from the committee table:
dim rs, sqlstr, adoCon, htmlComm, rsC
set adoCon = Server.CreateObject("ADODB
.Connectio
n")
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("/fpdb/info
.mdb")
set rs = Server.CreateObject("ADODB
.Recordset
")
set rsC = Server.CreateObject("ADODB
.Recordset
")
sqlstr = "SELECT * FROM committeeMembers"
sqlstrC = "SELECT committeeName FROM committee ORDER by committeeName DESC"
rs.Open sqlstr, adoCon,3,3
rsC.Open sqlstrC, adoCon,3,3
htmlComm = ""
htmlComm = htmlComm & "<select id=committeeID name=committeeID style='width: 300px;'>"
do while not rsC.EOF
htmlComm = htmlComm & "<option selected value=" & rsC(0) & ">" & rsC("committeeName") & "</option>" & vbCr
rsC.movenext
loop
htmlComm = htmlComm & "</select>" & vbCr
This is the process page:
set rs = Server.CreateObject("ADODB
.Recordset
")
set rsC = Server.CreateObject("ADODB
.Recordset
")
sqlstr = "SELECT * FROM committeeMembers"
sqlstrC = "SELECT * FROM committee"
rs.Open sqlstr, adoCon,3,3
rsC.Open sqlstrC, adoCon,3,3
rs.AddNew
committeeTitle = Request.Form("committeeTit
le")
committeeFname = Request.Form("committeeFna
me")
committeeLname = Request.Form("committeeLna
me")
committeeLocation = Request.Form("committeeLoc
ation")
committeePhone = Request.Form("committeePho
ne")
sortorder = Request.Form("sortorder")
committeeID = Request.Form("committeeID"
)
rs.addNew
rs("committeeTitle") = committeeTitle
rs("committeeFname") = committeeFname
rs("committeeLname") = committeeLname
rs("committeeLocation") = committeeLocation
rs("committeePhone") = committeePhone
rs("sortorder") = sortorder
rs("committeeID") = committeeID
rs.Update
rs.Close
I am sure the problem is with how I am getting the committeeID from the dropdown box and passing it to the committeemembers table but I do not see the problem
Start Free Trial