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!

View Will Not Refresh? Creating Dynamic SQL

Status
Not open for further replies.

smedvid

MIS
May 28, 1999
1,228
US
I am perplexed over this one... I have a screen where I permit the users to construct an SQL Select Statement and Where Clause. It works great! Problem is on second execution of SQL to create a view, the original view fields appear.

Is there a option on Execute to force database cache to clear or insure new records, or is the issue on the Create View? Any clues are appreciated.



'Delete Existing View If Found
' Create temp view
lcSQL = " IF EXISTS(SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS " _
& " WHERE TABLE_NAME = '" & lcViewName & "')" _
& " DROP VIEW " & lcViewName & " "

DBConn.Execute lcSQL, , adExecuteNoRecords

lcSQL = "CREATE VIEW " & lcViewName & " AS (" & Me.txtSQL.Value & ")"

DBConn.Execute lcSQL, , adExecuteNoRecords

DoCmd.OpenView lcViewName, , acReadOnly



Steve Medvid
"IT Consultant & Web Master"

Chester County, PA Residents
Please Show Your Support...
 
After extensive research... my solution was to refresh the connection.. before launching the view via OpenView
This solved the issue... Albeit, not te optimal solution, it works...



Steve Medvid
"IT Consultant & Web Master"

Chester County, PA Residents
Please Show Your Support...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top