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

Refreshing Updated Data Table

Status
Not open for further replies.

ericpsu32

Programmer
Sep 15, 2003
47
US
Hi,

I have a dilemma. I have created a form in ADP that allows the user the ability to contrain a dataset based on their needs. They can then, from that constrained dataset, pull only the fields they would like. I have written a stored procedure that will do this, I wrote code to pass all the parameters to the procedure. It first loads a shell table with the constrained data, then builds the SQL Select statement of that newly updated table based on parameters passed. It then drops a temp table that houses only the fields the user selected and creates a new one. The final result, a table with only the number of fields selected and constrained according to the users wishes. The issue...The final result is not reflected back in ADP when I export the table to an excel file using the outputto macro. What I appear to be missing is the correct way to refresh the data tables in my ADP as the table I wish to output looks great in SQL, but not in my Project. I have tried requery, refresh, assign the form to be the table, etc. No luck. Any help would be greatly appreciated.
 
Since you have a new table then somehow you need to refresh the database window.

Public Function testConn()
'' This should work, but doesn't
''Application.RefreshDatabaseWindow

'' Microsoft suggested work around, which I tested.
Dim cBars As Office.CommandBars
Dim cBarCtl As Office.CommandBarControl

DoCmd.SelectObject acTable, , True
Set cBars = Application.CommandBars
Set cBarCtl = cBars.FindControl(msoControlButton, 3812)
If Not cBarCtl Is Nothing Then
cBarCtl.Execute
End If
End Function

See Microsoft Article
Need a reference to Office Library 9.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top