Solved

Visual Basic question

Posted on 1997-09-12
2
512 Views
Last Modified: 2013-11-25
Dear experts

I have some trouble with data control. The refresh method runs one time.
If I want to repeat it again an error occurs.

I made the following steps

I made a temporary table for changing values:
-db.Execute  "select * into [tempTableName] from [TableName]",dbFailOnError
-db.TableDefs.Refresh
-data.RecordSource=tempTableName
-data.refresh ' no error occurs at this first execution of refresh.

Then I change a value in dbGrid (dbgrid.DataSource=data )
-data.UpdateRecord
Save table with  tempTableName to table withTableName
-data.RecordSource="dummy" 'is a empty table in db
-data.refresh ' no error occurs
-db.Execute "drop table [TableName]",dbFailOnError
-db.Execute "select * into [TableName] from [tempTableName]",dbFailOnError
-db.Execute "drop table [tempTableName]",dbFailOnError
-db.TableDefs.Refresh
Then I want to show the same table in the dbGrid
-I made a temporary table and then
-data.RecordSource=tempTableName
An error occurs, if the data.refresh method is executed again
Remark:
The error occurs at one special  table only. The table consists of 41 Columns,13 Rows.
At all other tables no error occurs.
Error message occurs in different VB4 moduls:
 
dbGrid.ocx 0005:341B
DAO2516.DLL 002D:0044
...

Thanks for any help!

0
Comment
Question by:micha71
2 Comments
 
LVL 3

Accepted Solution

by:
dansari earned 150 total points
ID: 1434818
micha71:

Didn't the error occur because you executed a 'drop tempTableName' before setting the RecordSource to that table that does not exist any more?  The Refresh probably failed because of this.

If I'm getting something wrong here, please comment.

0
 

Author Comment

by:micha71
ID: 1434819
Dear dansari

I do have the tempTableName indeed.
Because I deleted them after SYSTEM CRASH.

I execute a ' select * into tempTableName from TableName ' before
the RecordSource will be set again.

Thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question