Help With Requery of a control on a Subform

D

Del

Hello,

I have an Access 2000 database that I want to use to keep track of the
part numbers being used for new parts. The main form has all the data
regarding the part (Setup Date, Part Nbr Assigned, Purchased or
Manufactured, Supplier, etc). I also have a subform (Call
frmNextAvailablePartNbrSubfrm)on the main page that is linked via a
query that pulls the next available part number from a table that has
a list of all the available part number our department is allowed to
use. On the "On Exit" event of last field of the main form I run some
code that runs a Delete Query. The delete query removes the Part
Number that was just asigned from the "tblAvailablePartNbr" table. I
am also attempting to then requery the Subform so it will display the
next available part number from the "tblAvailablePartNbr" table.

When I exit the last control on the main page the delete query works
and the part number used is deleted from the table. The subform then
show #Deleted
And I get an error when the requery code is run.
The error reads;

Run-Time Error '2450'
Microsoft Access can't find the form "frmNextAvailablePartNbrSubfrm"
referred to in a macro expression or visual basic code.

I have tried using Me!SubformControlName.Requery and
Forms!SubformName!SubformControlName.Requery

Thank you for any assistance or ideas.

Del
 
R

Ragnar Midtskogen

When you refer to a subform you need to following the subform name with the
property Form, since this is not the default property

To requery the subform you would use Me!SubFormName.Form.Requery

To refer to a control on a subform Me!SubFormName.Form!ControlName

Ragnar
 

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