PinnacleDan
Programmer
I am new to this forum and hope I am in the right category.
I have a program that clears an Access table then, in a loop, inserts several records into it.
I then load the table into a datagrid for review.
The problem is that the last record inserted does not display in the grid. I added a 1-second delay after the insert and the problem seems resolved. However, I am sure this is not the right way to ensure the insert is complete before I read the table. Any help?
I have a program that clears an Access table then, in a loop, inserts several records into it.
Code:
SQL="Insert Into Materials (JobCode, Item)"
SQL=SQL & "Values ('" & CurJob & "','" & CurItem & "')"
DB2.Execute SQL, dbFailOnError
I then load the table into a datagrid for review.
Code:
SQL = "Select * From Materials "
frmRpt2.AdodcR1.RecordSource = SQL
frmRpt2.AdodcR1.Refresh
frmRpt2.DataGrid1.Refresh
The problem is that the last record inserted does not display in the grid. I added a 1-second delay after the insert and the problem seems resolved. However, I am sure this is not the right way to ensure the insert is complete before I read the table. Any help?