Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: DAO Execute Method


Message #1 by "Raju S.Pusapati" <rajupusapati@y...> on Mon, 25 Feb 2002 19:35:31
Hi,
I have created a procedure to retrieve the records from table and also to 
perform certain database function.But the following code is not working 
and every time i try to run the program the db.execute SQL command is not 
performing and my system hangs up. My table contain more than 165000 
records.Is there any restrictions/limitations on using db.execute and DAO?
Please let me know,what changes I have to make.
Thanks.
Dim strSQL As String
     
    Set db = DBEngine.OpenDatabase(dname)
'   Add a new field, called TempField, of the correct type in the table
    strSQL = "alter table [" & [strTableName] & "] add column 
[TempField] " & strFieldType & ";"
    db.Execute strSQL
'   Copy the data from the existing column to the new column
    strSQL = "update distinctrow [" & [strTableName] & "] set [" & 
strFieldName & "]=[TempField];"
    db.Execute strSQL
'   Delete the existing field from the table
    strSQL = "alter table [" & [strTableName] & "] drop column [" & 
strFieldName & "];"
    db.Execute strSQL
'   Change the new field name back to the existing field name
    db.TableDefs(strTableName).Fields("TempField").Name = strFieldName
    Set db = Nothing

  Return to Index