Code stopped working - delete and append (1 Viewer)

pbuethe

Returning User
Local time
Today, 12:27
Joined
Apr 9, 2002
Messages
210
Here is my code. This has been running OK for years, now suddenly the delete and append queries do not seem to be running.

Private Sub cmdFacilityDist_Click()
On Error GoTo cmdFacilityDist_Err
DoCmd.SetWarnings False
DoCmd.OpenQuery "delFacilityHits", acNormal, acEdit
DoCmd.SetWarnings False
DoCmd.OpenQuery "ApdFacDistAll", acNormal, acEdit
DoCmd.SetWarnings False
Calc_Fac_Total

DoCmd.OpenForm "frmOrderDetail_FacDist", acNormal, , , acFormEdit, acDialog, (Me.Name)

cmdFacilityDist_Exit:
Exit Sub
cmdFacilityDist_Err:
MsgBox Error$
Resume cmdFacilityDist_Exit
End Sub

This code is supposed to:
1.delete all data in table FacilityHits
2.Append new data to table FacilityHits
3.Call Calc_Fac_Total to calculate a facility distribution from FacilityHits
4.Open form frmOrderDetail_FacDist to display the facility distribution

Now, clicking the button has no effect on FacilityHits. The form opens displaying the old data. Also, when I commented out the lines with
"DoCmd.SetWarnings False" and ran the code again, the warnings still did not appear. I appreciate any help or advice.
 

Husan

Registered User.
Local time
Today, 17:27
Joined
Jan 29, 2009
Messages
45
I would firstly check the queries:
run query "delFacilityHits" manually followed by query "ApdFacDistAll" and see if they work ok.

if its worked before, then i would guess that the queries have changed more than likely they just selct queries rather tha ction queries ie updated/append.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 17:27
Joined
Sep 12, 2006
Messages
15,657
what do acedit do? is it relevant to an action query?
 

pbuethe

Returning User
Local time
Today, 12:27
Joined
Apr 9, 2002
Messages
210
Looking at it again, it actually looks like those queries were working. However, the field ListNbr in FacilityHits had an old value in it. That was partly what made me think that the table was not updating. After I compacted the back end, which contains the table that ListNbr comes from, I reran another process which successfully assigned the new value of ListNbr to FacilityHits. I *think* all the data is correct now. Thanks for your replies, Husan and gemma.
 

Users who are viewing this thread

Top Bottom