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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Click a button, open new form, close old form! 3

Status
Not open for further replies.

ChrisTheAncient

Technical User
Dec 22, 2002
169
0
0
GB

I call up a new form - from an existing form - with a button click...

Code:
    DoCmd.Close         'close the existing "CustomerDatabase" form

    stDocName = "ActiveCustomers"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

However, using this method, there is a distinct 'flash' between forms.

Is there a way to open the new form first and then close the old one 'underneath' it.

TIA

Chris


*************************************
OK, I'm stoopid. But I'm good at it!
*************************************
 
Something like this ?
DoCmd.OpenForm "ActiveCustomers", , , stLinkCriteria
DoCmd.Close acForm, "CustomerDatabase"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Something like this will do it:

DoCmd.OpenForm "frm User Sign In"
DoCmd.Close acForm, "frm Startup"

you can replace form names with variables of course - as you did in your example.
 
If you still are not happy with the transition between the forms, try this:

'open the second form, but hides it
DoCmd.OpenForm stDocName, , , stLinkCriteria, , acHidden

'closes the current form
DoCmd.Close

'Shows the second form (looks to see if it is already loaded, if so, it shows it)
DoCmd.OpenForm stDocName

---------------------------------------
The customer may not always be right, but the customer is ALWAYS the customer.
 
What a fabulous response.

Thanks folks - I'm dead happy.

I tried PHV's first and it does exactly what I want. Thanks.

Looks like Evalesthy was the same.

Where I was going wrong was with my syntax on the CloseFrom commad. Easy once you know how!

NorthNone. That's a sort of way I was trying to go - with a hidden attribute coming in. I got in even more of a tangle!

Again, megathanks for the help!

Chris

*************************************
OK, I'm stoopid. But I'm good at it!
*************************************
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top