0

I have a problem when I move to the next form, the record that I've just added does not show. For example I typed "123456" then go the next form, and it will just show the previous record, not the "123456". It will only show when I stop the program then run it again and the "123456" will show on the second form's textbox.

Form1 code:

Private Sub Command1_Click()
    Form2.Hide
    Form1.Show
    Adodc1.Recordset.Update
End Sub

Private Sub Form_Load()
    Adodc1.Recordset.AddNew
End Sub

Form2 code:

Private Sub Command1_Click()
    Adodc1.Recordset.Update
End Sub

Private Sub Form_Load()
    Adodc1.Refresh
    Adodc1.Recordset.MoveLast
End Sub

Does anyone know why it's not showing until I restart?

Deanna
  • 23,876
  • 7
  • 71
  • 156

3 Answers3

0

It might have something to do with the Jet database engine using lazy writes as answered in this StackOverflow question.

Community
  • 1
  • 1
Kelly Ethridge
  • 1,669
  • 1
  • 11
  • 12
0

Using you ADO Data Controls with a DataEnvironment should eliminate the use of separate Connections to the database. I suspect that's really where your headaches are coming from.

If you are using VBA all bets are off, but then you should not have tagged your question VB6!

Bob77
  • 13,167
  • 1
  • 29
  • 37
0

Some note for ADODC:

  • For refresh state: Adodc1.Recordset.Requery
  • If you use DataGrid or any controller for update records, you must leave the currently edited record before committing changes. (the currently edited row is not a change in DataGrid)
andras.tim
  • 1,964
  • 1
  • 13
  • 23