Unassociated Subform (1 Viewer)

SkyCraw

Registered User.
Local time
Today, 11:27
Joined
Oct 9, 2013
Messages
100
Good day everyone, me again...

I have a main form, used for inputting information, as well as two associated (by associated, I mean linked master and child field(s)) subforms and one unassociated subform (used as a search form).

Is it possible to not make the unassociated search form refresh whenever the main form is refreshed?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 10:27
Joined
Feb 19, 2002
Messages
42,970
No. Me.Requery on a main form will requery the subforms also. I don't use Me.Refresh but I would assume it works the same way.

If you want to keep track of where you are, you might consider changing your form structure. You would have an unbound form that contains the search form and the current "main form" with its subforms.

The other possibility requires code. You would need to save the record ID for the search form. Then when you requery/refresh the current main form, you would add code to reposition the search subform to the saved recordID. You can't use bookmarks for this purpose since the bookmarks change when the query is rerun.
 

SkyCraw

Registered User.
Local time
Today, 11:27
Joined
Oct 9, 2013
Messages
100
Okay, that is doable for me. Would you have any sample code by any chance? I tried this method in the past, just was never able to position the search form properly.

If so, that would be great :)
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 10:27
Joined
Feb 19, 2002
Messages
42,970
If I had sample code handy, I would have posted it. Perhaps someone else has some. You should be able to work it out. Save the ID. Then after the requery/refresh. Use the FindFirst method to find the ID.
 

David R

I know a few things...
Local time
Today, 09:27
Joined
Oct 23, 2001
Messages
2,633
I used to put my search boxes in my Header/Footer, but I suspect both that and your subform approach lend themselves to more headaches than they are worth. Now I always make Search its own popup form and I have much less headaches.
 

SkyCraw

Registered User.
Local time
Today, 11:27
Joined
Oct 9, 2013
Messages
100
Setting my search form up as a popup form was what I originally ended up doing, just to solve this current issue... but then I ran into another form issue when performing a search, which I posted a while ago in another forum (can't post links yet, so this will have to do):

Initial Form Focus
I don't know if this is a good title for this question I have... but what I'm trying to do is bring the focus to a pop-up form when an end user clicks out of Access (say, into Outlook or another software window) then back into Access.

EDIT: What's happening is an end user performs utilizes "Find" to look for a serial number in a popup form. Once he finds the desires serial number, he highlights the entire serial number in the control, copies and pastes it in an email; not exiting out of the "Find" he performed. When he tries to continue the search, the column switches to a column on the non-popup form which is open at the same time.

Is there any way to prevent this from happening? Where he can do things like this and the "Find" function doesn't jump forms when leaving (and then coming back to) Access?

This is when I decided to just reattach it to my "main form"; this solved the problem mentioned in the linked forum but now I'm back to square one. :banghead:

If someone knew how to solve the issue I'm having with popup forms, that would the "cure-all" to this.
 

David R

I know a few things...
Local time
Today, 09:27
Joined
Oct 23, 2001
Messages
2,633
At a guess, did you make your popup form Modal in Properties? That should stop Access from letting them go back to the main form until they are done with the search... unless I misunderstand what "the column switches to a column on the non-popup form which is open at the same time" means.
 

SkyCraw

Registered User.
Local time
Today, 11:27
Joined
Oct 9, 2013
Messages
100
I tried making my popup search form model, but to no avail. If I initiate a search within one control on the popup form, click somewhere on the popup then back on the search window, it jumps to a control on my main form.

This time, I'll go into further detail of how it should behave...

Basically, what I would like it to do is have the search's focus stay on whichever control they begin the search within until they are finished with the current search. It should behave like this even if they click within another control on the popup form or another software window (ie. Outlook, Excel, etc.).
 

David R

I know a few things...
Local time
Today, 09:27
Joined
Oct 23, 2001
Messages
2,633
Modal should stop Access from letting you touch any other form/report/etc, period. I don't understand why it wouldn't in this case...

Okay, let me try a different question. Are you saying that if they search for [SerialNo], you want the main form to focus on [SerialNo] once it displays the result, but if they search for [LastName], SetFocus should go to [LastName]?

Or do you want the form to go back to the LAST field they were in before they hit the search button? Or some third thing?
 

SkyCraw

Registered User.
Local time
Today, 11:27
Joined
Oct 9, 2013
Messages
100
I thought it would have also... Does the use of tabbed windows within Access prohibit this? We use tabbed merely because it's more organized.

But yes, until they stop the search or start a new one, I want the SetFocus to stay on the control the end user initiated the search in.
 

Users who are viewing this thread

Top Bottom