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

Updating subform with current data 1

Status
Not open for further replies.

DLynnTX

IS-IT--Management
Dec 9, 2004
67
US
I have a form with tabs and have information on one of the tabs from a subform. The subform gets its' data from a series of queries. Just for info, it's emergency numbers (ems, police or sheriff, etc) based on whether the client is in or out of the city limits and what city/county/zip combo they are. I have queries to pull numbers for locations out of city limits, numbers for locations in the city limits, match both separately to client ID's and then end up with a table with the combined data. I created a macro that runs a delete query to clear the table, then runs the two "final" queries to pull in the city and county info. I coded to run that macro "on current" for that tab. However, it shows "deleted" in all the fields.

I also did a union query and based the form on that query and it worked fine. However, it SEVERELY slows the database in that it is apparently updating everytime I move to another record.

If you need more info or specifics, please let me know. And thank you in advance for your help. I keep hoping that one day I'll be able to return the favor. :)
 
How are ya DLynnTX . . .
DLynnTX said:
[blue]I coded to run that macro "on current" for that tab. However, it [purple]shows "deleted"[/purple] in all the fields.[/blue]
You need to [blue]requery[/blue] the subform after the last query is run.

If your code is running in the mainform:
Code:
[blue]   [[purple][b][i]SubFormName[/i][/b][/purple]].Form.[b]Requery[/b][/blue]
If its running in the subform:
Code:
[blue]   Me.Requery[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
AceMan - thank you for your response. However, I do not understand where I'm supposed to put that. I have the name of the macro in "On Current" of the subform. Where does the requery go? I'm sorry for not understanding.
 
DLynnTX . . .

Post the code in the [blue]On Current[/blue] event!

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Thank you... I added requery to the end of my macro and it worked like a charm. Appreciate your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top