S
Shawn
I created a form so people can input request information via series of
combo and text boxes and submit the request by clicking a command
button. The thing is that each request will have multiple steps before
they are completed, so I created an events table to track each step.
At the moment I have a SQL INSERT statement to add the information from
the form to the request table, but I do not know how I would insert a
record into the events table with same id from the request table. In
the events table I have an events ID which is an autonumber datatype
and an req_id with a number datatype, so I can have a relationship
between the two tables. Does anyone have an idea of how I would update
events table with a new record containing the request id from the
submitted request? Below is the code I have so far for the command
button.
Private Sub cmd_request_Click()
Dim strsql
strsql = "INSERT INTO tbl_request (fname, lname, geid, m_fname,
m_lname, m_geid, platform,"
strsql = strsql & " app, req_type, status, isa, submitted)
VALUES ('" & Me.cbo_fname & "',"
strsql = strsql & " '" & Me.cbo_lname & "', '" & Me.txt_geid &
"', '" & Me.cbo_m_fname & "',"
strsql = strsql & " '" & Me.cbo_m_lname & "', '" &
Me.txt_m_geid & "', '" & Me.cbo_platform & "',"
strsql = strsql & " '" & Me.cbo_app & "', '" & Me.cbo_type &
"', 'Open', '" & fOSUserName() & "',"
strsql = strsql & " '" & Me.lbl_datetime.Caption & "')"
DoCmd.RunSQL strsql, False
End Sub
combo and text boxes and submit the request by clicking a command
button. The thing is that each request will have multiple steps before
they are completed, so I created an events table to track each step.
At the moment I have a SQL INSERT statement to add the information from
the form to the request table, but I do not know how I would insert a
record into the events table with same id from the request table. In
the events table I have an events ID which is an autonumber datatype
and an req_id with a number datatype, so I can have a relationship
between the two tables. Does anyone have an idea of how I would update
events table with a new record containing the request id from the
submitted request? Below is the code I have so far for the command
button.
Private Sub cmd_request_Click()
Dim strsql
strsql = "INSERT INTO tbl_request (fname, lname, geid, m_fname,
m_lname, m_geid, platform,"
strsql = strsql & " app, req_type, status, isa, submitted)
VALUES ('" & Me.cbo_fname & "',"
strsql = strsql & " '" & Me.cbo_lname & "', '" & Me.txt_geid &
"', '" & Me.cbo_m_fname & "',"
strsql = strsql & " '" & Me.cbo_m_lname & "', '" &
Me.txt_m_geid & "', '" & Me.cbo_platform & "',"
strsql = strsql & " '" & Me.cbo_app & "', '" & Me.cbo_type &
"', 'Open', '" & fOSUserName() & "',"
strsql = strsql & " '" & Me.lbl_datetime.Caption & "')"
DoCmd.RunSQL strsql, False
End Sub