Pop up search form

cynapattery

Registered User.
Local time
Today, 12:02
Joined
Jul 9, 2013
Messages
28
How to open a search form with a mouse click on Button_Search

My idea is to pop up a form where user can enter the search text and select the required name and get back to the old form with all details about the entry.
refered to thread t=188663 in this forum (sorry i couldn't post links)
to create the search form. This form alone is workign fine. I want to call it in a mouse click. and pass the data back to old form.
 
Code:
Private Sub Button_Search_Click()
     DoCmd.OpenForm "YourFormName", , , , , acDialog
End Sub

Use the OnClose event of the search form to copy the data into the main form.
 
You can do it by on property sheet >other tab>pop up to yes.
 
Thanks a lot it works fine as I wished I am also posting the code here for some one else further reference.

Private Sub Cmd_Search_Click()
On Error GoTo Err_Cmd_search_Click
DoCmd.OpenForm "FRM_SearchMulti"
Forms!FRM_SearchMulti.SetFocus
Exit_Cmd_search_Click:
Exit Sub

Err_Cmd_search_Click:
MsgBox Err.Description
Resume Exit_Cmd_search_Click
End Sub
 
Hi Mihail,

I am not well versed in vb/access. Could you please explain little more what you meant in last post? should I change this setfocus?
I have pop up yes already set for the search pop up window)
 
If your approach is working then is good enough.
When you set the property for a form to be "pop up" is presumed that that form keep the focus and the flow of the code stop in that form.
Only when you close that form the flow of the code should run to the next instruction.
DoCmd.OpenForm "FRM_SearchMulti" should move the focus and the entire logic to the form FRM_SearchMulti. When (and only WHEN) you close this form the flow should move to the next instruction (Forms!FRM_SearchMulti.SetFocus - in your case).
But, because a bug, that do not happen (in case you setup the property in the propertyes manager).
On the other hand, by using my code, the focus (and the code flow) remain in the form FRM_SearchMulti. So you can manage anything at this form level.
On the other other hand :) this come with a new bug: the form FRM_SearchMulti randomly change it's height. And this must be managed by using other code :banghead:.
So, if your actual code is working well then keep it.
 
Till now the system works as I wish and the size of the pop up window is not changed automtically. :) also according to my code, the control should move to the pop up window till I double click a content.

Thanks again.
 

Users who are viewing this thread

Back
Top Bottom