Data update not show

I have some code to insert some values into a temp table, then open a new form with a CR viewer... It seems that the data doesn't "make it" to the table be the time the report opens / datatable is populated... (CR datasource is the datatable)

If i add a msgbox("a") to pause it, it works great... however this is NOT a solution...

Any ideas???

Im off to bed so ill be back in a few hours.

LVL 34
Who is Participating?

 I see, Dave...

This is happening because Access is VERY it doesn't have time to do the insert.. before you are asking him the dates from the database... it doesn't depend on you... you send him the sql and how time it takes to Access to execute the sql you will never know... depends on many things..

In this case, I see only 2 solutions:

1)you can assume that it takes 5 seconds(you can estimate this time on your PC) to do 1000 inserts on a pentium 4 at 2400 Mhz... so create a thread to open your new form... tell him to sleep for 5 sec... and then do whatever you want... this is a solution when you know the maximum number of inserts and the system your application will run...

2)do the inserts row by row in a loop... after you insert the last row then open your new form

I don't know who takes more time :)
Hi,  flavo!

i think it's impossible to have this kind of problem in the same thread. you say that :
1)first  insert some values into a temp datatable
2)and then open a new form with a CR viewer

be sure that, in the same thread, step 2) will be made only after step 1) is done.
on the other hand, if you do step 2) in another thread... start the thread only after you're sure step 1) is finished..

hope this helps...
if it doesn't, paste your code to see what is the problem..

flavoAuthor Commented:
That's what i thought...

I dont have it on me now but basically,


Delete * from myTable
Insert some values into myTable
open other form


Get data from myTable and put it into a dt
Set the dt to the datasoruce for the CR

No threads, just 2 different forms.. Im using Access as a BackEnd...

I was thinking about this last night, and i tihink i just may just go away with the temp table and just pass the datatable, but still coudn't understand why this was happening.......

flavoAuthor Commented:
>> Access is VERY SLOW

Yeah.. i found it in another form when adding a record, then refeshing a datagrid down the bottom (adding 1 record, maybe 10 records in table) and still didint update, but that was a logical place to add a msgbox "Data Saved"

I have got around it by creating a datatable in my first form, and passing that to the form with the CR viewer.  Saves my using the temp table.. seems to work so far...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.