Hi,
I need to append multi records from append query call temp to table tblProductions. In fact, they seems to work fine but i like to happen if any record in both columns found then message "There is a duplicate." else run the query.
I have a button to run this query in a mainform. below is my current code.
Private Sub cbupdate_serialno_Click()
If Me.txtStartno = 0 Or IsNull(Me.txtStartno) Then
MsgBox "Startno needs values"
Me.txtStartno.SetFocus
ElseIf Me.txtEndno = 0 Or IsNull(Me.txtEndno) Then
MsgBox "Endno needs values"
Me.txtEndno.SetFocus
ElseIf Me.cbproducer = 0 Or IsNull(Me.cbproducer) Then
MsgBox "Producer needs value"
Me.cbproducer.SetFocus
ElseIf Me.cbVillage = 0 Or IsNull(Me.cbVillage) Then
MsgBox "Village is empty"
Me.cbVillage.SetFocus
ElseIf Me.cbWorker1 = 0 Or IsNull(Me.cbWorker1) Then
MsgBox "Please enter Worker name."
Me.cbWorker1.SetFocus
ElseIf Me.cbRecorder = 0 Or IsNull(Me.cbRecorder) Then
MsgBox "Recorder is empty"
Me.cbRecorder.SetFocus
ElseIf Me.txtLotserialno = 0 Or IsNull(Me.txtLotserialno) Then
MsgBox "Please enter Serial code."
Me.txtLotserialno.SetFocus
Else
If MsgBox("Sure! you want to submit data?", vbYesNo, "Becareful:") = vbYes Then
DoCmd.OpenQuery "update to tblProductions"
MsgBox "Finished."
End If
End If
Me.Refresh
End Sub
I would appreciate for any help. Thank you in advance.
Regards,
I need to append multi records from append query call temp to table tblProductions. In fact, they seems to work fine but i like to happen if any record in both columns found then message "There is a duplicate." else run the query.
I have a button to run this query in a mainform. below is my current code.
Private Sub cbupdate_serialno_Click()
If Me.txtStartno = 0 Or IsNull(Me.txtStartno) Then
MsgBox "Startno needs values"
Me.txtStartno.SetFocus
ElseIf Me.txtEndno = 0 Or IsNull(Me.txtEndno) Then
MsgBox "Endno needs values"
Me.txtEndno.SetFocus
ElseIf Me.cbproducer = 0 Or IsNull(Me.cbproducer) Then
MsgBox "Producer needs value"
Me.cbproducer.SetFocus
ElseIf Me.cbVillage = 0 Or IsNull(Me.cbVillage) Then
MsgBox "Village is empty"
Me.cbVillage.SetFocus
ElseIf Me.cbWorker1 = 0 Or IsNull(Me.cbWorker1) Then
MsgBox "Please enter Worker name."
Me.cbWorker1.SetFocus
ElseIf Me.cbRecorder = 0 Or IsNull(Me.cbRecorder) Then
MsgBox "Recorder is empty"
Me.cbRecorder.SetFocus
ElseIf Me.txtLotserialno = 0 Or IsNull(Me.txtLotserialno) Then
MsgBox "Please enter Serial code."
Me.txtLotserialno.SetFocus
Else
If MsgBox("Sure! you want to submit data?", vbYesNo, "Becareful:") = vbYes Then
DoCmd.OpenQuery "update to tblProductions"
MsgBox "Finished."
End If
End If
Me.Refresh
End Sub
I would appreciate for any help. Thank you in advance.
Regards,
Last edited: