Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening one form causes two forms to open. Why?

Status
Not open for further replies.

ACSeval

Technical User
Joined
Jul 22, 2003
Messages
9
Location
US

I've got a form that allows the user to select one of two options via "buttons." If they select one button, it should start a macro which is set to open another form. If they click on the other button, it should start a macro which is set to open a report.

The wierd thing is that when I open this first form, the second form that should only be launched when the user clicks the button (to start that particular macro) is already open. The form window for this second form is just sitting there behind my first form window, waiting for input, even though the button designed to launch the macro which opens that second form hasn't even been hit yet.

My buttons work when clicked, and guide the user through the program appropriately, but the other form window pops up as soon as the first form window opens, and I'd like to keep this from happening. It should only open when the button for that selection is clicked. I looked in properties of my first form to see if any OnOpen commands were mistakenly placed, but I didn't see any.

I don't know VBA or SQL, and am sort of bouncing my way through the programming of this thing. Any ideas as to what might be causing the other form window to launch prior to user input?

Thanks for any ideas. (step-by-step descriptions are much more helpful due to my lack of VBA & SQL knowledge)

ACSEval
 
Delete your micro and in the "on click" property event of the button insert:
Dim Docname As String
Docname = "FormName"
DoCmd.OpenForm Docname
 
Hi,

Have a look at the <On Open> event of your first form.
Sounds like this is kicking off your second form.

Barring that, then look at ALL events in the first form, one event is probably opening your second form.

If not the form events, look at all controls on the first form - one of these could open your second form.

It may well be a <Got focus> event in this case of one of the controls on this form.

Kind regards,

Darrylle




&quot;Never argue with an idiot, he'll bring you down to his level - then beat you with experience.&quot; darrylles@totalise.co.uk
 
Thanks... I put that code into my Code builder, but upon further testing discovered that the problem was my setting this same information in the box for OnEnter. I suppose the macro would have worked too if I eliminated the info from OnEnter.

Anyway, you helped me overcome that hurdle...thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top