A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

closing a form when opening another form



 
 
Thread Tools Display Modes
  #1  
Old December 14th, 2005, 08:05 PM posted to microsoft.public.access
external usenet poster
 
Posts: n/a
Default closing a form when opening another form

I have a form that opens a popup form and this form takes the the user to a
specific record in the first form, using a command button. I want to close
the popup form once the the focus returns to the first form. I've tried
macros and adding a docmd string to the command buttons event procedure. I've
tried the macro on exit and lost of focus properties of the pop up form and
even on gotfocus in the first form. Nothing works. Any clue for the clueless?
  #2  
Old December 14th, 2005, 08:22 PM posted to microsoft.public.access
external usenet poster
 
Posts: n/a
Default closing a form when opening another form

I would use

sub Cmd_OnClick()

...all your other code...
docmd.close acform, me.name

end sub

in the click event of the command button on the pop up form; but you say
that doesn't work? What is the code you're using?

"Dan" wrote:

I have a form that opens a popup form and this form takes the the user to a
specific record in the first form, using a command button. I want to close
the popup form once the the focus returns to the first form. I've tried
macros and adding a docmd string to the command buttons event procedure. I've
tried the macro on exit and lost of focus properties of the pop up form and
even on gotfocus in the first form. Nothing works. Any clue for the clueless?

  #3  
Old December 14th, 2005, 09:50 PM posted to microsoft.public.access
external usenet poster
 
Posts: n/a
Default closing a form when opening another form

The following is a suggestion to rethink your approach a bit. One advantage
of the following method is that it keeps the popup from getting too
specialized. As it stands, you can only use it for one thing. If you keep it
more generic, it will be easier to use the form if you have a future need
for a simple "select a record" popup (say, to build report criteria?). The
Popup should simply allow the user to select a value. Any "specialized" code
that uses that value becomes the responsibility of the routine that opens it
(plus: you deftly avoid the always annoying lostFocus, Deactivate, yada,
yada issues).

'***************
Main Form (aircode):
docmd.OpenForm "Popup"
Do while popup.visible = true
do events
loop

(On popup: when User makes selection, set popup.visible = false)

' Popup is now hidden
- Add Code to get selection value from hidden popup
DoCmd.Close acForm "Popup"
- Add Code to move to specified record on main form & set focus
'****************
HTH,
--
George Nicholson

Remove 'Junk' from return address.


"Dan" wrote in message
...
I have a form that opens a popup form and this form takes the the user to a
specific record in the first form, using a command button. I want to close
the popup form once the the focus returns to the first form. I've tried
macros and adding a docmd string to the command buttons event procedure.
I've
tried the macro on exit and lost of focus properties of the pop up form
and
even on gotfocus in the first form. Nothing works. Any clue for the
clueless?



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Move feild entries from form to form using global variables JackCGW General Discussion 11 November 14th, 2005 05:22 AM
Form won't open report from preview button jwr Using Forms 5 October 29th, 2005 04:53 PM
using combo boxes with Filter by Form baconroll General Discussion 3 October 28th, 2005 04:23 PM
Design help, please SillySally Using Forms 27 March 6th, 2005 04:11 AM
dlookup miaplacidus Using Forms 9 August 5th, 2004 09:16 PM


All times are GMT +1. The time now is 01:58 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.