Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: UPDATE and then SELECT immediately


Message #1 by "Enzo Zaragoza" <enzaux@g...> on Fri, 28 Feb 2003 17:51:07 +0800
*Using VB6, MS Access 2k, ADO 2.5

	I have a Batch sheet form(main form) and Cargo Boxes are listed in a list view control
I add/remove Cargo Boxes from the batch form. By clicking a "+" button a form will pop-up
to ask for a cargo ID, if the cargo ID is valid then it would execute an UPDATE statement
so that it will be included in the batch, below is the SQL statement:

 "UPDATE tblCargo SET lngBatchID=" & BatchID & " WHERE lngCargoID=" & txtCargoID.text

And then after updating the Cargo Box Transaction, it will refresh(populate) the contents of
the list view control, which should show the recent Cargo Box that I've added(updated) in the
batch, but it seems that it do not fetch the latest addition in the batch.  

	I'm populating the list view control with data from the Cargo Table in this manner:
1.) open dbase connection
2.) open a recordset ("SELECT tblCargo.lngCargoID, . . . FROM tblCargo INNER JOIN ....so on")
3.) loop thru the records to populate the list view
4.) close dbase connection and recordset
	
But when I try to have a msgbox stating that a new cargo box is successfully added after
the UPDATE and the re-populate the list view, then that's the time I can see the new cargo
box added.	

It seems that it is taking time for the UPDATE to take effect and for the SELECT to fetch
the recent update.  Is there any explanation on why this is happening?  I can't figure out
why do I still need to have msgbox inorder for the SELECT statement see the recent UPDATE?


Thanks,

enzo c",)



  Return to Index