i have a continous form with a command button which opens a password form when you are validated rightly the "post button" on the password form should do the following
1) insert records whose checked boxes are checked into another table payment
2) delete the same checked and inserted record from the table i used as a temporary storage
3) leave the records whose checked boxes are not checked in my temporary table
this is the code i've so far
Private Sub CMDLOGIN_Click()
On Error GoTo Err_CMDLOGIN_Click
Dim STDOCNAME As String
Dim THEQUERY As String
Dim THEQUERY2 As String
Dim Msg, Style, Title, Response, MyString
Dim strMsg As String 'MsgBox message.
Msg = "Authorisation Cancelled" ' Define message.
Style = vbOKOnly
Title = "mindBASE" ' Define title.
THEQUERY = "INSERT INTO [NEW PAYMENTS3] SELECT * FROM [NEW PAYMENTS] WHERE TAG = -1"
THEQUERY2 = "delete from [NEW PAYMENTS] WHERE [TAG] = -1"
'Check to see if data is entered into the UserName combo box
If IsNull(Me.Combo22) Or Me.Combo22 = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.Combo22.SetFocus
Exit Sub
End If
'Check to see if data is entered into the password box
If IsNull(Me.Text24) Or Me.Text24 = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.Text24.SetFocus
Exit Sub
End If
DoCmd.Close acForm, "PASSWORD DBA", acSaveNo
If Me.Text24.Value = DLookup("PASSWORD", "AUTHORISATION", _
"[USERID]=" & Me.Combo22.Value) Then
USERID = Me.Combo22.Value
'Close logon form and open splash screen
DoCmd.Close acForm, "AUTHORISATION PAYMENT", acSaveNo
DoCmd.SetWarnings True
DoCmd.RunSQL THEQUERY
DoCmd.SetWarnings False
DoCmd.RunSQL THEQUERY2
DoCmd.RunMacro "CLOSE PAYMENT TEMP"
DoCmd.OpenForm "PAYMENT FORM TEMP"
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, _
"mindBASE!"
Me.Text24.SetFocus
End If
Exit_CMDLOGIN_Click:
Exit Sub
Err_CMDLOGIN_Click:
Response = MsgBox(Msg, Style, Title)
End Sub
1) insert records whose checked boxes are checked into another table payment
2) delete the same checked and inserted record from the table i used as a temporary storage
3) leave the records whose checked boxes are not checked in my temporary table
this is the code i've so far
Private Sub CMDLOGIN_Click()
On Error GoTo Err_CMDLOGIN_Click
Dim STDOCNAME As String
Dim THEQUERY As String
Dim THEQUERY2 As String
Dim Msg, Style, Title, Response, MyString
Dim strMsg As String 'MsgBox message.
Msg = "Authorisation Cancelled" ' Define message.
Style = vbOKOnly
Title = "mindBASE" ' Define title.
THEQUERY = "INSERT INTO [NEW PAYMENTS3] SELECT * FROM [NEW PAYMENTS] WHERE TAG = -1"
THEQUERY2 = "delete from [NEW PAYMENTS] WHERE [TAG] = -1"
'Check to see if data is entered into the UserName combo box
If IsNull(Me.Combo22) Or Me.Combo22 = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.Combo22.SetFocus
Exit Sub
End If
'Check to see if data is entered into the password box
If IsNull(Me.Text24) Or Me.Text24 = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.Text24.SetFocus
Exit Sub
End If
DoCmd.Close acForm, "PASSWORD DBA", acSaveNo
If Me.Text24.Value = DLookup("PASSWORD", "AUTHORISATION", _
"[USERID]=" & Me.Combo22.Value) Then
USERID = Me.Combo22.Value
'Close logon form and open splash screen
DoCmd.Close acForm, "AUTHORISATION PAYMENT", acSaveNo
DoCmd.SetWarnings True
DoCmd.RunSQL THEQUERY
DoCmd.SetWarnings False
DoCmd.RunSQL THEQUERY2
DoCmd.RunMacro "CLOSE PAYMENT TEMP"
DoCmd.OpenForm "PAYMENT FORM TEMP"
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, _
"mindBASE!"
Me.Text24.SetFocus
End If
Exit_CMDLOGIN_Click:
Exit Sub
Err_CMDLOGIN_Click:
Response = MsgBox(Msg, Style, Title)
End Sub