Append Query depending on check box

Dannyc989

Registered User.
Local time
Today, 17:31
Joined
Dec 18, 2013
Messages
46
Hi Folks,

I'm after a piece of code which works as described below.

I have a save button on a form
I have a append query ready to run.

When the save button is clicked, I want the code to see if a checkbox is true or not and if its true I want the append query to run if its not then I want the form to save and nothing else. Anyone able to help??

Thanks in advance

Daniel
 
I am assuming its the record you wish to save not the form

Would this work
#on click

If me.checkbox = -1 then

Dim stdocName as string
stdocName = "nameof appendqry"
Docmd. openquery stdocName , acNormal , acEdit
If Me.Dirty Then Me.Undo
Else
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
end if #

Above not tested , Note by closing the form the record is normally saved the undo command just does undoes any changes you made to the record .

hope this of use to you

Regards Ypma
 

Users who are viewing this thread

Back
Top Bottom