View Single Post
Old 09-21-2019, 08:19 PM   #1
T. McConnell
Newly Registered User
 
Join Date: Jun 2019
Posts: 38
Thanks: 12
Thanked 0 Times in 0 Posts
T. McConnell is on a distinguished road
Have to run an append query twice??

Hey all,
I am having an issue I have an append query that is to add new records to a table. The query is tied to a button that checks to see if a checkbox is checked and if so to run the append query. The problem is when I check the box and then click my Save button nothing is copied over, but if I go back into the record and re-save it again the data shows up. I have tried the below code but it only seems to work if I do it twice. The commented section out are the other ways I tried to run the query but same result each time. Any suggestions would be greatly appreciated.

MoveToInventory is the checkbox name and of course QryExpenseToInventory is my query which copies over certain fields to the OtherInventory table.

Code:
Private Sub btnSave_Click()
If Me.MoveToInventory.Value = True Then
'CurrentDb.Execute "QryExpenseToInventory"
'DoCmd.OpenQuery "QryExpenseToInventory", acNormal, acEdit
DoCmd.SetWarnings False
DoCmd.OpenQuery "QryExpenseToInventory"
DoCmd.SetWarnings True
End If
End Sub
I have another query similar to this one based on the same button and both do the same, nothing shows up unless I run the save button again.

Thanks!

T. McConnell is offline   Reply With Quote