A
all21
dear all,
i'm sorry for my english.........
i have a form that contains several text boxes, 1 combo box, + 2 buttons....
the buttuons are : add & exit.....
after i enter the data from my form, i click the add button and it says like
the title:
error message 2501 the runcommand action was cancelled.
here the code behind that button :
Private Sub save_Click()
On Error GoTo Err_save_Click
If Me.NoPembayaran.Value <> "" Then
DoCmd.SetWarnings False
If Me.totalbyr.Value - Me.totalbeli.Value >= 0 Then
DoCmd.RunSQL "UPDATE TBLPembelianHeader SET TBLPembelianHeader.bayar
= True WHERE (((TBLPembelianHeader.NoTransaksi)='" & Me.No_Pembelian & "'));"
End If
DoCmd.RunCommand acCmdSaveRecord
DoCmd.GoToRecord , , acNewRec
Else
MsgBox "Nomor Pembayaran Tidak Boleh Kosong!", vbInformation + vbOKOnly,
"Perhatian"
Me.NoPembayaran.SetFocus
End If
Exit_save_Click:
Exit Sub
Err_save_Click:
MsgBox "Error " & Err.Number & ": " & Err.Description & " in save_Click"
Resume Exit_save_Click
End Sub
i've try to change the code like this :
Private Sub save_Click()
On Error GoTo Err_save_Click
If Me.NoPembayaran.Value <> "" Then
DoCmd.SetWarnings False
If Me.totalbyr.Value - Me.totalbeli.Value >= 0 Then
DoCmd.RunSQL "UPDATE TBLPembelianHeader SET TBLPembelianHeader.bayar
= True WHERE (((TBLPembelianHeader.NoTransaksi)='" & Me.No_Pembelian & "'));"
End If
'DoCmd.RunCommand acCmdSaveRecord <=== i marked the save record line as
comment
DoCmd.GoToRecord , , acNewRec
Else
MsgBox "Nomor Pembayaran Tidak Boleh Kosong!", vbInformation + vbOKOnly,
"Perhatian"
Me.NoPembayaran.SetFocus
End If
Exit_save_Click:
Exit Sub
Err_save_Click:
MsgBox "Error " & Err.Number & ": " & Err.Description & " in save_Click"
Resume Exit_save_Click
End Sub
but when i click the save button, i still get error message:
error 2105 : you can't go to the specified record
help me please.......................
i'm sorry for my english.........
i have a form that contains several text boxes, 1 combo box, + 2 buttons....
the buttuons are : add & exit.....
after i enter the data from my form, i click the add button and it says like
the title:
error message 2501 the runcommand action was cancelled.
here the code behind that button :
Private Sub save_Click()
On Error GoTo Err_save_Click
If Me.NoPembayaran.Value <> "" Then
DoCmd.SetWarnings False
If Me.totalbyr.Value - Me.totalbeli.Value >= 0 Then
DoCmd.RunSQL "UPDATE TBLPembelianHeader SET TBLPembelianHeader.bayar
= True WHERE (((TBLPembelianHeader.NoTransaksi)='" & Me.No_Pembelian & "'));"
End If
DoCmd.RunCommand acCmdSaveRecord
DoCmd.GoToRecord , , acNewRec
Else
MsgBox "Nomor Pembayaran Tidak Boleh Kosong!", vbInformation + vbOKOnly,
"Perhatian"
Me.NoPembayaran.SetFocus
End If
Exit_save_Click:
Exit Sub
Err_save_Click:
MsgBox "Error " & Err.Number & ": " & Err.Description & " in save_Click"
Resume Exit_save_Click
End Sub
i've try to change the code like this :
Private Sub save_Click()
On Error GoTo Err_save_Click
If Me.NoPembayaran.Value <> "" Then
DoCmd.SetWarnings False
If Me.totalbyr.Value - Me.totalbeli.Value >= 0 Then
DoCmd.RunSQL "UPDATE TBLPembelianHeader SET TBLPembelianHeader.bayar
= True WHERE (((TBLPembelianHeader.NoTransaksi)='" & Me.No_Pembelian & "'));"
End If
'DoCmd.RunCommand acCmdSaveRecord <=== i marked the save record line as
comment
DoCmd.GoToRecord , , acNewRec
Else
MsgBox "Nomor Pembayaran Tidak Boleh Kosong!", vbInformation + vbOKOnly,
"Perhatian"
Me.NoPembayaran.SetFocus
End If
Exit_save_Click:
Exit Sub
Err_save_Click:
MsgBox "Error " & Err.Number & ": " & Err.Description & " in save_Click"
Resume Exit_save_Click
End Sub
but when i click the save button, i still get error message:
error 2105 : you can't go to the specified record
help me please.......................