Data update not show

Posted on 2004-10-25
Last Modified: 2010-05-18
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.

Question by:flavo
    LVL 1

    Expert Comment

    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..

    LVL 34

    Author Comment

    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.......

    LVL 1

    Accepted Solution


     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 :)
    LVL 34

    Author Comment

    >> 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...

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
    This video discusses moving either the default database or any database to a new volume.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    845 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

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now