File / Record Lock Error !! | | |
The Delete Event/Proc & "Save_Fields_In_Form_Header" Event/Proc in
my form were working perfectly.
However, after I added a call to the "Save_Fields_In_Form_Header"
Event/Proc in the "Current" Event of my form, and I now try to Delete
a record, I get ... Run-Time Error 3218 - Could not Update; Currently
Locked. My Access application then effectively freezes forcing me to
shut Access down & re-start.
The record DOES get deleted successfully.
What's happening is as follows:
1) I click the Delete command button on the form
2) The record gets deleted
3) The Current event gets fired & my Sub
"Save_Fields_In_Form_Header" gets called.
4) During the SQL update in the above Sub:
"Save_Fields_In_Form_Header", the above-mentioned error is triggered
on the foll statement: CurrentDb.Execute StrSql, dbFailOnError
I'm presuming here, the record is still locked by the "Delete" Event &
that's why a SQL UPDATE cannot lock the file.
I'm posting my 2 Subs here hoping someone can point out any mistakes /
workarounds.
Thx & Best Rgds,
Prakash.
----------------------------
Private Sub Save_Fields_In_Form_Header()
Dim StrSql As String
StrSql = "UPDATE JVTable SET JVTable.INV_DATE = " & _
IIf(IsNull(Me.Txt_Date),
"Null", DMY(Me.Txt_Date)) & ", " & _
"JVTable.RcdFm_PdTo = " & _
IIf(IsNull(Me.txt_RcdFm_PdTo), "Null", """" & Me.txt_RcdFm_PdTo &
"""") & ", " & _
"JVTable.Chq_No = " & _
IIf(IsNull(Me.txt_Chq_No),
"Null", """" & Me.txt_Chq_No & """") & ", " & _
"JVTable.Chq_Date = " & _
IIf(IsNull(Me.txt_Chq_Date), "Null", DMY(Me.txt_Chq_Date)) & ", " & _
"JVTable.Bank = " & _
IIf(IsNull(Me.txt_Bank),
"Null", """" & Me.txt_Bank & """") & ", " & _
"JVTable.Settled_Bill_Nos = " & _
IIf(IsNull(Me.txt_Settled_Bill_Nos), "Null", """" &
Me.txt_Settled_Bill_Nos & """")
CurrentDb.Execute StrSql, dbFailOnError
End Sub
...........................................
Private Sub Cmd_Delete_Click()
On Error GoTo Err_Cmd_Delete_Click
Dim stn As Byte, strControl As String
strControl = Screen.PreviousControl.Name
'MsgBox strControl
Application.Echo False
DoCmd.SetWarnings False
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
DoCmd.SetWarnings True
Me.DrTotal = DSum("DEBIT", "JVTable") ' After deleting a Record
Totals shd be re-calculated
Me.CrTotal = DSum("CREDIT", "JVTable")
stn = Sub_Tran_No - 1 'Saving Current Record Pointer
Position
Call Cmd_ReNumber_Click 'Re-Number the sub_tran_no field if
any record is DELETED
Me.Recordset.FindFirst "[sub_tran_no]=" & stn
If Me.Recordset.NoMatch Then
Me.Recordset.MoveLast
End If
Me.Controls(strControl).SetFocus
Application.Echo True
Exit_Cmd_Delete_Click:
Exit Sub
Err_Cmd_Delete_Click:
If Err.Number = 3021 Then 'user tries to delete an EOF or BOF
record
'MsgBox "No More Records To Delete !", vbOKOnly +
vbInformation, "Message..."
Me.Controls(strControl).SetFocus
Application.Echo True
Else
MsgBox Err.Description & " " & Err.Number
End If
Resume Exit_Cmd_Delete_Click
End Sub
........................................... | | | | re: File / Record Lock Error !!
In my experience, this error has always meant that your database has a
locked / bad record and is in need of repair. In access 97, this commonly
happened in memo fields. One solution to cut down on the frequency of this
error was to put after_update code on all memo fields to have the save the
record right away. However, in multi-user environments, I found that this
error could still happen.
The fix was to repair/compact the database using the JetComp utility. The
link I have is for access 97 only: http://support.microsoft.com/kb/295334
Hope this helps,
<prakashwadhwani@gmail.comwrote in message
news:8f0cdda3-f6d6-45fe-9da8-32d40a54b965@e25g2000prg.googlegroups.com... Quote:
The Delete Event/Proc & "Save_Fields_In_Form_Header" Event/Proc in
my form were working perfectly.
>
However, after I added a call to the "Save_Fields_In_Form_Header"
Event/Proc in the "Current" Event of my form, and I now try to Delete
a record, I get ... Run-Time Error 3218 - Could not Update; Currently
Locked. My Access application then effectively freezes forcing me to
shut Access down & re-start.
>
The record DOES get deleted successfully.
>
What's happening is as follows:
1) I click the Delete command button on the form
2) The record gets deleted
3) The Current event gets fired & my Sub
"Save_Fields_In_Form_Header" gets called.
4) During the SQL update in the above Sub:
"Save_Fields_In_Form_Header", the above-mentioned error is triggered
on the foll statement: CurrentDb.Execute StrSql, dbFailOnError
>
I'm presuming here, the record is still locked by the "Delete" Event &
that's why a SQL UPDATE cannot lock the file.
>
I'm posting my 2 Subs here hoping someone can point out any mistakes /
workarounds.
>
Thx & Best Rgds,
Prakash.
>
----------------------------
>
>
Private Sub Save_Fields_In_Form_Header()
Dim StrSql As String
>
StrSql = "UPDATE JVTable SET JVTable.INV_DATE = " & _
IIf(IsNull(Me.Txt_Date),
"Null", DMY(Me.Txt_Date)) & ", " & _
"JVTable.RcdFm_PdTo = " & _
>
IIf(IsNull(Me.txt_RcdFm_PdTo), "Null", """" & Me.txt_RcdFm_PdTo &
"""") & ", " & _
"JVTable.Chq_No = " & _
IIf(IsNull(Me.txt_Chq_No),
"Null", """" & Me.txt_Chq_No & """") & ", " & _
"JVTable.Chq_Date = " & _
>
IIf(IsNull(Me.txt_Chq_Date), "Null", DMY(Me.txt_Chq_Date)) & ", " & _
"JVTable.Bank = " & _
IIf(IsNull(Me.txt_Bank),
"Null", """" & Me.txt_Bank & """") & ", " & _
"JVTable.Settled_Bill_Nos = " & _
>
IIf(IsNull(Me.txt_Settled_Bill_Nos), "Null", """" &
Me.txt_Settled_Bill_Nos & """")
>
CurrentDb.Execute StrSql, dbFailOnError
>
End Sub
>
>
..........................................
>
>
Private Sub Cmd_Delete_Click()
On Error GoTo Err_Cmd_Delete_Click
>
Dim stn As Byte, strControl As String
strControl = Screen.PreviousControl.Name
'MsgBox strControl
Application.Echo False
>
DoCmd.SetWarnings False
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
DoCmd.SetWarnings True
>
Me.DrTotal = DSum("DEBIT", "JVTable") ' After deleting a Record
Totals shd be re-calculated
Me.CrTotal = DSum("CREDIT", "JVTable")
>
stn = Sub_Tran_No - 1 'Saving Current Record Pointer
Position
Call Cmd_ReNumber_Click 'Re-Number the sub_tran_no field if
any record is DELETED
>
Me.Recordset.FindFirst "[sub_tran_no]=" & stn
If Me.Recordset.NoMatch Then
Me.Recordset.MoveLast
End If
Me.Controls(strControl).SetFocus
Application.Echo True
>
Exit_Cmd_Delete_Click:
Exit Sub
>
Err_Cmd_Delete_Click:
If Err.Number = 3021 Then 'user tries to delete an EOF or BOF
record
'MsgBox "No More Records To Delete !", vbOKOnly +
vbInformation, "Message..."
Me.Controls(strControl).SetFocus
Application.Echo True
Else
MsgBox Err.Description & " " & Err.Number
End If
Resume Exit_Cmd_Delete_Click
>
End Sub
>
..........................................
>
>
| | | | re: File / Record Lock Error !!
By the way, if you search through the table and focus in on the memo field,
look for #error in the table. This will indicate the locked/bad record.
<prakashwadhwani@gmail.comwrote in message
news:8f0cdda3-f6d6-45fe-9da8-32d40a54b965@e25g2000prg.googlegroups.com... Quote:
The Delete Event/Proc & "Save_Fields_In_Form_Header" Event/Proc in
my form were working perfectly.
>
However, after I added a call to the "Save_Fields_In_Form_Header"
Event/Proc in the "Current" Event of my form, and I now try to Delete
a record, I get ... Run-Time Error 3218 - Could not Update; Currently
Locked. My Access application then effectively freezes forcing me to
shut Access down & re-start.
>
The record DOES get deleted successfully.
>
What's happening is as follows:
1) I click the Delete command button on the form
2) The record gets deleted
3) The Current event gets fired & my Sub
"Save_Fields_In_Form_Header" gets called.
4) During the SQL update in the above Sub:
"Save_Fields_In_Form_Header", the above-mentioned error is triggered
on the foll statement: CurrentDb.Execute StrSql, dbFailOnError
>
I'm presuming here, the record is still locked by the "Delete" Event &
that's why a SQL UPDATE cannot lock the file.
>
I'm posting my 2 Subs here hoping someone can point out any mistakes /
workarounds.
>
Thx & Best Rgds,
Prakash.
>
----------------------------
>
>
Private Sub Save_Fields_In_Form_Header()
Dim StrSql As String
>
StrSql = "UPDATE JVTable SET JVTable.INV_DATE = " & _
IIf(IsNull(Me.Txt_Date),
"Null", DMY(Me.Txt_Date)) & ", " & _
"JVTable.RcdFm_PdTo = " & _
>
IIf(IsNull(Me.txt_RcdFm_PdTo), "Null", """" & Me.txt_RcdFm_PdTo &
"""") & ", " & _
"JVTable.Chq_No = " & _
IIf(IsNull(Me.txt_Chq_No),
"Null", """" & Me.txt_Chq_No & """") & ", " & _
"JVTable.Chq_Date = " & _
>
IIf(IsNull(Me.txt_Chq_Date), "Null", DMY(Me.txt_Chq_Date)) & ", " & _
"JVTable.Bank = " & _
IIf(IsNull(Me.txt_Bank),
"Null", """" & Me.txt_Bank & """") & ", " & _
"JVTable.Settled_Bill_Nos = " & _
>
IIf(IsNull(Me.txt_Settled_Bill_Nos), "Null", """" &
Me.txt_Settled_Bill_Nos & """")
>
CurrentDb.Execute StrSql, dbFailOnError
>
End Sub
>
>
..........................................
>
>
Private Sub Cmd_Delete_Click()
On Error GoTo Err_Cmd_Delete_Click
>
Dim stn As Byte, strControl As String
strControl = Screen.PreviousControl.Name
'MsgBox strControl
Application.Echo False
>
DoCmd.SetWarnings False
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
DoCmd.SetWarnings True
>
Me.DrTotal = DSum("DEBIT", "JVTable") ' After deleting a Record
Totals shd be re-calculated
Me.CrTotal = DSum("CREDIT", "JVTable")
>
stn = Sub_Tran_No - 1 'Saving Current Record Pointer
Position
Call Cmd_ReNumber_Click 'Re-Number the sub_tran_no field if
any record is DELETED
>
Me.Recordset.FindFirst "[sub_tran_no]=" & stn
If Me.Recordset.NoMatch Then
Me.Recordset.MoveLast
End If
Me.Controls(strControl).SetFocus
Application.Echo True
>
Exit_Cmd_Delete_Click:
Exit Sub
>
Err_Cmd_Delete_Click:
If Err.Number = 3021 Then 'user tries to delete an EOF or BOF
record
'MsgBox "No More Records To Delete !", vbOKOnly +
vbInformation, "Message..."
Me.Controls(strControl).SetFocus
Application.Echo True
Else
MsgBox Err.Description & " " & Err.Number
End If
Resume Exit_Cmd_Delete_Click
>
End Sub
>
..........................................
>
>
| | | | re: File / Record Lock Error !!
On Mar 4, 3:27 am, "ARC" <PCES...@PCESoft.invalidwrote: Quote:
By the way, if you search through the table and focus in on the memo field,
look for #error in the table. This will indicate the locked/bad record.
>
<prakashwadhw...@gmail.comwrote in message
>
news:8f0cdda3-f6d6-45fe-9da8-32d40a54b965@e25g2000prg.googlegroups.com...
> Quote:
The Delete Event/Proc & "Save_Fields_In_Form_Header" Event/Proc in
my form were working perfectly.
> Quote:
However, after I added a call to the "Save_Fields_In_Form_Header"
Event/Proc in the "Current" Event of my form, and I now try to Delete
a record, I get ... Run-Time Error 3218 - Could not Update; Currently
Locked. My Access application then effectively freezes forcing me to
shut Access down & re-start.
> Quote:
The record DOES get deleted successfully.
> Quote:
What's happening is as follows:
1) I click the Delete command button on the form
2) The record gets deleted
3) The Current event gets fired & my Sub
"Save_Fields_In_Form_Header" gets called.
4) During the SQL update in the above Sub:
"Save_Fields_In_Form_Header", the above-mentioned error is triggered
on the foll statement: CurrentDb.Execute StrSql, dbFailOnError
> Quote:
I'm presuming here, the record is still locked by the "Delete" Event &
that's why a SQL UPDATE cannot lock the file.
> Quote:
I'm posting my 2 Subs here hoping someone can point out any mistakes /
workarounds.
> Quote:
Thx & Best Rgds,
Prakash.
> Quote:
----------------------------
> Quote:
Private Sub Save_Fields_In_Form_Header()
Dim StrSql As String
> Quote:
StrSql = "UPDATE JVTable SET JVTable.INV_DATE = " & _
IIf(IsNull(Me.Txt_Date),
"Null", DMY(Me.Txt_Date)) & ", " & _
"JVTable.RcdFm_PdTo = " & _
> Quote:
IIf(IsNull(Me.txt_RcdFm_PdTo), "Null", """" & Me.txt_RcdFm_PdTo &
"""") & ", " & _
"JVTable.Chq_No = " & _
IIf(IsNull(Me.txt_Chq_No),
"Null", """" & Me.txt_Chq_No & """") & ", " & _
"JVTable.Chq_Date = " & _
> Quote:
IIf(IsNull(Me.txt_Chq_Date), "Null", DMY(Me.txt_Chq_Date)) & ", " & _
"JVTable.Bank = " & _
IIf(IsNull(Me.txt_Bank),
"Null", """" & Me.txt_Bank & """") & ", " & _
"JVTable.Settled_Bill_Nos = " & _
> Quote:
IIf(IsNull(Me.txt_Settled_Bill_Nos), "Null", """" &
Me.txt_Settled_Bill_Nos & """")
> Quote:
CurrentDb.Execute StrSql, dbFailOnError
> > Quote:
..........................................
> Quote:
Private Sub Cmd_Delete_Click()
On Error GoTo Err_Cmd_Delete_Click
> Quote:
Dim stn As Byte, strControl As String
strControl = Screen.PreviousControl.Name
'MsgBox strControl
Application.Echo False
> Quote:
DoCmd.SetWarnings False
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
DoCmd.SetWarnings True
> Quote:
Me.DrTotal = DSum("DEBIT", "JVTable") ' After deleting a Record
Totals shd be re-calculated
Me.CrTotal = DSum("CREDIT", "JVTable")
> Quote:
stn = Sub_Tran_No - 1 'Saving Current Record Pointer
Position
Call Cmd_ReNumber_Click 'Re-Number the sub_tran_no field if
any record is DELETED
> Quote:
Me.Recordset.FindFirst "[sub_tran_no]=" & stn
If Me.Recordset.NoMatch Then
Me.Recordset.MoveLast
End If
Me.Controls(strControl).SetFocus
Application.Echo True
> Quote:
Exit_Cmd_Delete_Click:
Exit Sub
> Quote:
Err_Cmd_Delete_Click:
If Err.Number = 3021 Then 'user tries to delete an EOF or BOF
record
'MsgBox "No More Records To Delete !", vbOKOnly +
vbInformation, "Message..."
Me.Controls(strControl).SetFocus
Application.Echo True
Else
MsgBox Err.Description & " " & Err.Number
End If
Resume Exit_Cmd_Delete_Click
> > Quote:
..........................................
I don't have any memo fields in my table. Hope you have any other
ideas ??
Best Rgds,
Prakash. | | | | re: File / Record Lock Error !!
On Mar 4, 9:41 am, prakashwadhw...@gmail.com wrote: Quote:
On Mar 4, 3:27 am, "ARC" <PCES...@PCESoft.invalidwrote:
>
>
> Quote:
By the way, if you search through the table and focus in on the memo field,
look for #error in the table. This will indicate the locked/bad record.
> Quote:
<prakashwadhw...@gmail.comwrote in message
> Quote:
news:8f0cdda3-f6d6-45fe-9da8-32d40a54b965@e25g2000prg.googlegroups.com...
> Quote: Quote:
The Delete Event/Proc & "Save_Fields_In_Form_Header" Event/Proc in
my form were working perfectly.
> Quote: Quote:
However, after I added a call to the "Save_Fields_In_Form_Header"
Event/Proc in the "Current" Event of my form, and I now try to Delete
a record, I get ... Run-Time Error 3218 - Could not Update; Currently
Locked. My Access application then effectively freezes forcing me to
shut Access down & re-start.
> Quote: Quote:
The record DOES get deleted successfully.
> Quote: Quote:
What's happening is as follows:
1) I click the Delete command button on the form
2) The record gets deleted
3) The Current event gets fired & my Sub
"Save_Fields_In_Form_Header" gets called.
4) During the SQL update in the above Sub:
"Save_Fields_In_Form_Header", the above-mentioned error is triggered
on the foll statement: CurrentDb.Execute StrSql, dbFailOnError
> Quote: Quote:
I'm presuming here, the record is still locked by the "Delete" Event &
that's why a SQL UPDATE cannot lock the file.
> Quote: Quote:
I'm posting my 2 Subs here hoping someone can point out any mistakes /
workarounds.
> Quote: Quote:
Thx & Best Rgds,
Prakash.
> Quote: Quote:
----------------------------
> Quote: Quote:
Private Sub Save_Fields_In_Form_Header()
Dim StrSql As String
> Quote: Quote:
StrSql = "UPDATE JVTable SET JVTable.INV_DATE = " & _
IIf(IsNull(Me.Txt_Date),
"Null", DMY(Me.Txt_Date)) & ", " & _
"JVTable.RcdFm_PdTo = " & _
> Quote: Quote:
IIf(IsNull(Me.txt_RcdFm_PdTo), "Null", """" & Me.txt_RcdFm_PdTo &
"""") & ", " & _
"JVTable.Chq_No = " & _
IIf(IsNull(Me.txt_Chq_No),
"Null", """" & Me.txt_Chq_No & """") & ", " & _
"JVTable.Chq_Date = " & _
> Quote: Quote:
IIf(IsNull(Me.txt_Chq_Date), "Null", DMY(Me.txt_Chq_Date)) & ", " & _
"JVTable.Bank = " & _
IIf(IsNull(Me.txt_Bank),
"Null", """" & Me.txt_Bank & """") & ", " & _
"JVTable.Settled_Bill_Nos = " & _
> Quote: Quote:
IIf(IsNull(Me.txt_Settled_Bill_Nos), "Null", """" &
Me.txt_Settled_Bill_Nos & """")
> Quote: Quote:
CurrentDb.Execute StrSql, dbFailOnError
> > Quote: Quote:
..........................................
> Quote: Quote:
Private Sub Cmd_Delete_Click()
On Error GoTo Err_Cmd_Delete_Click
> Quote: Quote:
Dim stn As Byte, strControl As String
strControl = Screen.PreviousControl.Name
'MsgBox strControl
Application.Echo False
> Quote: Quote:
DoCmd.SetWarnings False
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
DoCmd.SetWarnings True
> Quote: Quote:
Me.DrTotal = DSum("DEBIT", "JVTable") ' After deleting a Record
Totals shd be re-calculated
Me.CrTotal = DSum("CREDIT", "JVTable")
> Quote: Quote:
stn = Sub_Tran_No - 1 'Saving Current Record Pointer
Position
Call Cmd_ReNumber_Click 'Re-Number the sub_tran_no field if
any record is DELETED
> Quote: Quote:
Me.Recordset.FindFirst "[sub_tran_no]=" & stn
If Me.Recordset.NoMatch Then
Me.Recordset.MoveLast
End If
Me.Controls(strControl).SetFocus
Application.Echo True
> Quote: Quote:
Exit_Cmd_Delete_Click:
Exit Sub
> Quote: Quote:
Err_Cmd_Delete_Click:
If Err.Number = 3021 Then 'user tries to delete an EOF or BOF
record
'MsgBox "No More Records To Delete !", vbOKOnly +
vbInformation, "Message..."
Me.Controls(strControl).SetFocus
Application.Echo True
Else
MsgBox Err.Description & " " & Err.Number
End If
Resume Exit_Cmd_Delete_Click
> > Quote: Quote:
..........................................
>
I don't have any memo fields in my table. Hope you have any other
ideas ??
>
Best Rgds,
Prakash.
While stepping through the execution I realized what's causing the
error.
When I click the Delete button the foll statement :
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
causes the error:
The command or action 'SelectRecord' isn't available now. 2046
At this point my Access Application effectively freezes only allowing
me to shut down the App & Access.
I hope someone can point out where I'm going wrong.
Best Rgds,
Prakash. | | | | re: File / Record Lock Error !!
On Mar 4, 11:48 am, prakashwadhw...@gmail.com wrote: Quote:
On Mar 4, 9:41 am, prakashwadhw...@gmail.com wrote:
>
>
> Quote:
On Mar 4, 3:27 am, "ARC" <PCES...@PCESoft.invalidwrote:
> Quote: Quote:
By the way, if you search through the table and focus in on the memo field,
look for #error in the table. This will indicate the locked/bad record.
> Quote: Quote:
<prakashwadhw...@gmail.comwrote in message
> Quote: Quote:
>news:8f0cdda3-f6d6-45fe-9da8-32d40a54b965@e25g2000prg.googlegroups.com...
> Quote: Quote:
The Delete Event/Proc & "Save_Fields_In_Form_Header" Event/Proc in
my form were working perfectly.
> Quote: Quote:
However, after I added a call to the "Save_Fields_In_Form_Header"
Event/Proc in the "Current" Event of my form, and I now try to Delete
a record, I get ... Run-Time Error 3218 - Could not Update; Currently
Locked. My Access application then effectively freezes forcing me to
shut Access down & re-start.
> Quote: Quote:
The record DOES get deleted successfully.
> Quote: Quote:
What's happening is as follows:
1) I click the Delete command button on the form
2) The record gets deleted
3) The Current event gets fired & my Sub
"Save_Fields_In_Form_Header" gets called.
4) During the SQL update in the above Sub:
"Save_Fields_In_Form_Header", the above-mentioned error is triggered
on the foll statement: CurrentDb.Execute StrSql, dbFailOnError
> Quote: Quote:
I'm presuming here, the record is still locked by the "Delete" Event &
that's why a SQL UPDATE cannot lock the file.
> Quote: Quote:
I'm posting my 2 Subs here hoping someone can point out any mistakes /
workarounds.
> Quote: Quote:
Thx & Best Rgds,
Prakash.
> Quote: Quote:
----------------------------
> Quote: Quote:
Private Sub Save_Fields_In_Form_Header()
Dim StrSql As String
> Quote: Quote:
StrSql = "UPDATE JVTable SET JVTable.INV_DATE = " & _
IIf(IsNull(Me.Txt_Date),
"Null", DMY(Me.Txt_Date)) & ", " & _
"JVTable.RcdFm_PdTo = " & _
> Quote: Quote:
IIf(IsNull(Me.txt_RcdFm_PdTo), "Null", """" & Me.txt_RcdFm_PdTo &
"""") & ", " & _
"JVTable.Chq_No = " & _
IIf(IsNull(Me.txt_Chq_No),
"Null", """" & Me.txt_Chq_No & """") & ", " & _
"JVTable.Chq_Date = " & _
> Quote: Quote:
IIf(IsNull(Me.txt_Chq_Date), "Null", DMY(Me.txt_Chq_Date)) & ", " & _
"JVTable.Bank = " & _
IIf(IsNull(Me.txt_Bank),
"Null", """" & Me.txt_Bank & """") & ", " & _
"JVTable.Settled_Bill_Nos = " & _
> Quote: Quote:
IIf(IsNull(Me.txt_Settled_Bill_Nos), "Null", """" &
Me.txt_Settled_Bill_Nos & """")
> Quote: Quote:
CurrentDb.Execute StrSql, dbFailOnError
> > Quote: Quote:
..........................................
> Quote: Quote:
Private Sub Cmd_Delete_Click()
On Error GoTo Err_Cmd_Delete_Click
> Quote: Quote:
Dim stn As Byte, strControl As String
strControl = Screen.PreviousControl.Name
'MsgBox strControl
Application.Echo False
> Quote: Quote:
DoCmd.SetWarnings False
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
DoCmd.SetWarnings True
> Quote: Quote:
Me.DrTotal = DSum("DEBIT", "JVTable") ' After deleting a Record
Totals shd be re-calculated
Me.CrTotal = DSum("CREDIT", "JVTable")
> Quote: Quote:
stn = Sub_Tran_No - 1 'Saving Current Record Pointer
Position
Call Cmd_ReNumber_Click 'Re-Number the sub_tran_no field if
any record is DELETED
> Quote: Quote:
Me.Recordset.FindFirst "[sub_tran_no]=" & stn
If Me.Recordset.NoMatch Then
Me.Recordset.MoveLast
End If
Me.Controls(strControl).SetFocus
Application.Echo True
> Quote: Quote:
Exit_Cmd_Delete_Click:
Exit Sub
> Quote: Quote:
Err_Cmd_Delete_Click:
If Err.Number = 3021 Then 'user tries to delete an EOF or BOF
record
'MsgBox "No More Records To Delete !", vbOKOnly +
vbInformation, "Message..."
Me.Controls(strControl).SetFocus
Application.Echo True
Else
MsgBox Err.Description & " " & Err.Number
End If
Resume Exit_Cmd_Delete_Click
> > Quote: Quote:
..........................................
> Quote:
I don't have any memo fields in my table. Hope you have any other
ideas ??
> Quote:
Best Rgds,
Prakash.
>
While stepping through the execution I realized what's causing the
error.
When I click the Delete button the foll statement :
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
>
causes the error:
The command or action 'SelectRecord' isn't available now. 2046
>
At this point my Access Application effectively freezes only allowing
me to shut down the App & Access.
>
I hope someone can point out where I'm going wrong.
>
Best Rgds,
Prakash.
Please excuse my ignorance. The above-mentioned error i.e. Quote:
causes the error:
The command or action 'SelectRecord' isn't available now. 2046
is coming only because I'm stepping through the program & am in the
code window.
However ... my initial problem still remains ... BTW, dbFailOnError
gives an error number of 128. Does this mean anything to anyone ? Hope
someone can help me out.
Best Rgds,
Prakash. |  | Similar Microsoft Access / VBA bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,439 network members.
|