megatronixs
Registered User.
- Local time
- Today, 12:30
- Joined
- Aug 17, 2012
- Messages
- 719
Hi all,
I have a form that is based on an table called tbl_QC. I this table I have a review_id that is linked to the main table data. I have 5 buttons that create a QC recored int the tbl_QC. the review_id is passed, and the nr of the button for the QC. I would like to open the form based on the review id, that the first date is filled in and the qc_nr (that comes from the button and is passed with the "insert into")
My tbl_QC has the following fields (well, more of them, but the important ones I mention):
qc_id (autonumber)
date_1 (date passed via the button 1, the current date)
date_2 (date passed via the button 2 , the current date)
date_3 (date passed via the button 3 , the current date)
date_4 (date passed via the button 4 , the current date)
date_5 (date passed via the button 5 , the current date)
reveiw_id
qc_nr (it will be passed by the button used, 1, 2 and so on)
as you can see from below code, it is for the button 1:
Any way to pass the qc_nr to below code when I open the form?
Greetings.
I have a form that is based on an table called tbl_QC. I this table I have a review_id that is linked to the main table data. I have 5 buttons that create a QC recored int the tbl_QC. the review_id is passed, and the nr of the button for the QC. I would like to open the form based on the review id, that the first date is filled in and the qc_nr (that comes from the button and is passed with the "insert into")
My tbl_QC has the following fields (well, more of them, but the important ones I mention):
qc_id (autonumber)
date_1 (date passed via the button 1, the current date)
date_2 (date passed via the button 2 , the current date)
date_3 (date passed via the button 3 , the current date)
date_4 (date passed via the button 4 , the current date)
date_5 (date passed via the button 5 , the current date)
reveiw_id
qc_nr (it will be passed by the button used, 1, 2 and so on)
as you can see from below code, it is for the button 1:
Code:
Private Sub add_qc_1_Click() ' to add the first QC to the table
Dim stDocName As String
Dim stLinkCriteria As String
On Error GoTo Err_add_qc_1_Click
Dim strSql3 As String
DoCmd.SetWarnings False
'strSql3 = "Insert Into tbl_QC (review_id, date_1) Values (review_id = [Review_ID], Date())"
strSql3 = "Insert Into tbl_QC (review_id, date_1, qc_nr) Values ([Review_ID], Date(), '1')"
DoCmd.RunSQL strSql3
DoCmd.SetWarnings True
stDocName = "frm_QC_Form"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Me.add_qc_1.Enabled = False
Me.[final_4_eye_1st] = Date
Me.Refresh
Exit_add_qc_1_Click:
Exit Sub
Err_add_qc_1_Click:
MsgBox Err.Description
Resume Exit_add_qc_1_Click
End Sub
Any way to pass the qc_nr to below code when I open the form?
Code:
Private Sub Form_Load()
Me.review_id.Value = [Forms]![frm_Edit_Main_Reviews]![review_id]
End Sub
Greetings.