Solved

Visual Basic question

Posted on 1997-09-12
2
509 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

773 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