Tb.Update followed by SF.Requery problem

M

Michel

Hi everyone,

I'm having an intermittent problem with a requery that I can't fix.

Here is the situation.

I'm using a form to enter transactions. The main form contains a sub form
to display the last transcations already entered into the system for a
specific account. When the user has finished entering a new transaction, he
press a OK button and I save the transaction to a table using VBA then I do a
requery on the sub form (based on the same table) to display the last
transactions that should include the one just entered. The problem is that
the requery works one out of three times. Other times, the transaction just
entered does not appear in the sub form as it should. I can confirm that the
transactions are all properly registered in the table, but not showing in the
sub form.

Here is the portion of the code involved:
'' *******************************

Dim Base02 As DAO.Database
Dim TbTransaction As Recordset
Dim NmTbTransaction As String
NmTbTransaction = "T_Transaction"
Set Base02 = DAO.OpenDatabase(DonnéesClient)
' Base02 is a backend mdb;
' DonnéesClient is the path to that mdb
Set TbTransaction = Base02.OpenRecordset(NmTbTransaction, dbOpenTable)
If ModeOuvForm = "Nouvelle" Then 'New transaction
TbTransaction.AddNew
Else 'Modification 'The same form is used also for
modifications
TbTransaction.Index = "NoEnr"
TbTransaction.Seek "=", CtrlNoEnr
If TbTransaction.NoMatch Then
MsgBox "Transaction non trouvée", , _
"PARQUET - Modification d'une transcation"
End If
TbTransaction.Edit
End If

TbTransaction("DateTrans") = CtrlDateTrans
TbTransaction("NoPropriétaire") = ModifNoPropriétaire
TbTransaction("NoCompte") = ModifNoCompte
TbTransaction("NoTitre") = ModifNoTitre
TbTransaction("NoCourtier") = ModifNoCourtier
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top