Data not updating before print report

  • Thread starter Thread starter nickcrisp
  • Start date Start date
N

nickcrisp

Guest
Hi

I am trying to write vb code to produce invoices from delivery notes.

Open detail recordset
Set invoice qtys
movenext
Update recordset

Open header Recordset
Set invoice no, invoice date, invoice exchange rate
update recordset

Print Invoice

However, when I print the invoice, the record changes made above have not been posted to the database. If I open a msgbox asking print invoice, it works ok if I leave it 10 seconds before clicking but not if I click as sson as the message box appears.

Why are the changes to the database not made immediatly. If I check the database after the code has run, the changes appear correctly.


Thanks (Hope it makes sense)
 

Attachments

Hi, first some remarks:

1. when you declare multiple variables on one line, you've to give them all the type, like:
Dim i As Integer, j As integer.
When you declare:
Dim i, j As Integer: i would be a variant and not an integer.

2. Why do you use a workspace? You set it and close it, but that's everything...


Then what I think what's the problem: you first have to save the record of your form, with DoCmd.runCommand acCmdSaveRecord
I'd think it's working then.

Luck,
Bert
 

Users who are viewing this thread

Back
Top Bottom