View Full Version : Printing from a Form


Freelak
08-21-2001, 01:30 PM
I really need some help. I'm getting an error when I try to print a record form a form. This works fine in another database. The database name is CUSTOMER. The command for the action is as follows:

stDocName = "Normal"
DoCmd.OpenReport stDocName, acViewPreview, , "[CUSTNUMBER] = '" & Me![CUSTNUMBER] & "'"

When I click the button, I get an error:

The database engine could not lock table 'CUSTOMER' because it is already in use by another person or process

I am using Microsoft Access 2000, Stand-alone machine, activating a button to print. OS is Windows 98. The only other process I can think of that is using the database is the form itself.

Please help! Thank You!

Jack Cowley
08-21-2001, 02:59 PM
If your CustomerNumber is Text then your code is correct. I will assume it is text. Make a quick temporary form with just enough stuff to try your code. If it works then you current form is corrupt.

Freelak
08-22-2001, 05:12 AM
Thank you for your reply!

I did what you said, created a new form with just 2 fields and the command button. Still got the same error!

I did come up with a work around however. Created 2 macros, 1 to copy the table to a "temp" table and another to delete it.
I changed the report to use fields from the temp table.

In the event procedure, I ran the first macro to before the printing. I ran the second after the print.

I get an error if it is a preview, but it works fine if it is set to normal.

If you have any other ideas of what might be causing this, Please let me know.

Thanks!

The_Doc_Man
08-22-2001, 07:32 AM
Perhaps you could set the report's properties to avoid locking things.

Open the REPORT (not the form) in Design view. Right-Click on form's selection box (upper left corner of the design view at the intersection of the two rulers). Select properties. Select "Other properties." For Record Locks select "None" and see if that helps.

Freelak
08-24-2001, 09:40 AM
Thank You!

The report I was using was set for record lock. Changing this took care of the problem.

Thank You Again!