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!

subform requery problem

Status
Not open for further replies.

Talonjpc

Programmer
Jul 29, 2002
21
0
0
US
Hi everyone.

I have a subform that displays the software installed to a server. I also have another form that deals with software by itself.

I have that subform on a master form. When I open the software entry form and add a new piece of software or delete a piece of software, the software entry form requeries the software subform. However if I have the cursor in the software subform (blinking or not) and I try to add new software, it says it cannot find the subform. I cannot figure out how to get focus away from the subform when I open the software entry form so that the update can work properly. I try to change to focus but nothing seems to work. Some other info

The subform is requeried from code in the software entry form after insert and deletion

Thanks,
Vinay


 
Hiya,

Not sure how you call the 'software entry form', but I assume you do it from a button on the 'main form'.

If so - can the very first instruction not set focus to a field (the button for eg) on the main form - before opening the 'software entry form'.

If I'm on the wrong track, can you show some code - and where it is run from?

Regards,

Darrylle
"Never argue with an idiot, he'll bring you down to his level - then beat you with experience."
 
I just used the SetFocus command and it worked. I guess before I was using DoCmd.GotoControl. I guess the setfocus command slipped my mind. wow thanks
 
hmmm new problem. the subform doesn't appear to be requerying correctly. I see it refresh but the combo box doesn't have the new software. Is there anyway I can requery the specific combo box inside the subform that is inside the form? Here is some more info

The software subform is located on a seperate page of its own on the main form, but that page is open when the requery happens

Again, thanks for your help
Vinay
 
It looks like I figured it out. Instead of having the software entry form requery the subform I created an Event Procedure for the On Activate Event of the subform combo box:

DoCmd.Requery "SoftwareName"

This is probably inefficient to requery it every time but my database is only 5mb so there is no noticiable slowdown
 
Also, combo boxes, and list boxes have a Requery method.

You could refer to it directly from the form as:
Me.cbo1.Requery

Or through a sub form:
Me.child01.cbo1.Requery

-Doug
 
Forgot to say that I tried that, for some reason it didn't requery correctly. I think it has to do with the way to two actions work. I know they work a little differently
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top