Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
mforman
Starting Member
1 Post |
Posted - 2009-10-19 : 13:39:07
|
At the beginning of a function in a subform, I run this code to truncate a couple SQL tables:MySQL = "TRUNCATE TABLE tblNewHPNonSerialized; " & _"TRUNCATE TABLE tblNewHPSerialized; "ExecuteSQLQueryNoRecords MySQL, 1The Definition of "ExecuteSQLQueryNoRecords" is:Dim qdfTemp As QueryDefDim rst1 As ObjectIf Left(AnySQL, 6) = "SELECT" ThenCurrentDb.QueryDefs("qrySQL").SQL = AnySQLCurrentDb.QueryDefs("qrySQL").Connect = "ODBC;DSN=VR_HewlettPackard;Description=Vendor Receivables ODBC connection for VR_HewlettPackard;UID=" & UserID & ";DATABASE=VR_HewlettPackard;Network=DBMSSOCN;Trus ted_Connection=Yes"Set rst = CurrentDb.OpenRecordset("qrySQL")ElseDim db, qdfSet db = CurrentDbSet qdf = db.CreateQueryDef("")qdf.ReturnsRecords = Falseqdf.Connect = "ODBC;DSN=VR_HewlettPackard;Description=Vendor Receivables ODBC connection for VR_HewlettPackard;UID=" & UserID & ";DATABASE=VR_HewlettPackard;Network=DBMSSOCN;Trus ted_Connection=Yes"qdf.ODBCTimeout = 0qdf.SQL = AnySQLqdf.Executeqdf.CloseSet db = NothingSet qdf = NothingEnd IfThe problem I'm having is that the truncating function keeps getting stuck and I have to force quit it. I've tried a number of things to fix this. The truncating code works when I put it in a separate form and run it, so I've deduced that it has something to do with being in a subform. It also seems to be related to the number of records in the tables since it truncates the first table (tblNewHPNonSerialized) fine but seems to get stuck on the second table (tblNewHPSerialized), which usually has about 20K records.I haven't been able to find any threads discussing a similar problem. Any ideas? I know I could build a work around by having it pop up a separate form to do the truncating, but I'd rather figure out the problem if possible rather than build a work around. Thanks! |
|
|
|
|