Write / Print Same Record

G

Guest

I have a subForm populated from a main form, but I only write the record if
specific conditions are met. Once they are met though, I want the user to
click a button on the subform and add the record and print that specific
record at the same time.

I was trying to use AddNewRec, but I can't do that because once they add the
record that way, the subForm clears and the button gives an error message.
Is there a way to update the table and print that same record? For example
instead of an AddNewRecord, is there an UpdateTable or and UpdateNewRecord?

Any help would be appreciated.
 
J

John W. Vinson

I have a subForm populated from a main form, but I only write the record if
specific conditions are met. Once they are met though, I want the user to
click a button on the subform and add the record and print that specific
record at the same time.

I was trying to use AddNewRec, but I can't do that because once they add the
record that way, the subForm clears and the button gives an error message.
Is there a way to update the table and print that same record? For example
instead of an AddNewRecord, is there an UpdateTable or and UpdateNewRecord?

AddNewRecord does just that - it stops what you are doing and adds a new
(blank) record.

To save the current record to disk use

If Me.Dirty Then Me.Dirty = False

or

DoCmd.RunCommand acCmdSaveRecord

You can then use the OpenReport method to open a report to print the record;
use the optional WhereCondition argument to pass a unique ID to specify which
record should be printed.

John W. Vinson [MVP]
 

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