Reset not running query (1 Viewer)

odun

Registered User.
Local time
Today, 06:29
Joined
Apr 24, 2005
Messages
108
Hello all, I posted this earlier but got no response, please help!

I have the following event procedure in my Reset button on my form:

Code:
Private Sub cmdClearAll_Click()
' Clear All TextBoxes and Set all Check boxes to false (no tick)
Dim ctl As Control
For Each ctl In Me.Controls
    If ctl.ControlType = acTextBox Then
        ctl.Value = ""
    ElseIf ctl.ControlType = acCheckBox Then
        ctl.Value = False
        
    End If
Next ctl
Set ctl = Nothing

End Sub

I also have a macro on my execute button which opens another form, Form B, runs the query behind the new form and closes the query.

I noticed that when I open my current form, Form A, click the reset button to clear all the fields and then fill in a few fields or leave the fields blank and then click the Execute button. The query does not run at all and Form B opens up blank with no data populated. Do you know why? But if close the form and reopen it and click the execute button, it works okay? Does anyone know what I am doing wrong?

Please help

Thanks for your help.
 

Rickster57

Registered User.
Local time
Today, 06:29
Joined
Nov 7, 2005
Messages
431
query

Are you using a save record function before running that query? Sounds like a save/refresh issue.
 

odun

Registered User.
Local time
Today, 06:29
Joined
Apr 24, 2005
Messages
108
Hi, how do I find out if I am using a save/refresh or save record?
Thanks
 

Rickster57

Registered User.
Local time
Today, 06:29
Joined
Nov 7, 2005
Messages
431
Save Record

Before firing off that macro try this...it will save the record.


DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
 

odun

Registered User.
Local time
Today, 06:29
Joined
Apr 24, 2005
Messages
108
Hi, you've lost me.

My Execute button has a macro attached to it: On Click: MacroName

My macro opens Form B, runs the query based on the form A and closes the query.
Where do I put this new code you suggested?
 

Rickster57

Registered User.
Local time
Today, 06:29
Joined
Nov 7, 2005
Messages
431
In the On Click event of that button remove the macro and use event proceudre.

Then place the code..

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.RunMacro "Mymacro"
 

odun

Registered User.
Local time
Today, 06:29
Joined
Apr 24, 2005
Messages
108
Hmmm Rickster57,
I am learning something new....I didn't know I could do that...

I tried it:

Private Sub Command4_Click()
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.RunMacro "M1T1Macro"

but it's not working...what am I missing?

This code is in my execute button, not my reset button...is this what I should do? could it be my macro?
My macro opens the second Form, Form B, runs the query and then closes the query and the information shows up on Form B.

Thanks for your help
 
Last edited:

Users who are viewing this thread

Top Bottom