Small problem

Brian Martin

Registered User.
Local time
Today, 08:25
Joined
Jul 24, 2002
Messages
68
I've just added the following code behind a button.

The code works but a message box appears saying "This action requires an object name argument"

Forms![Product List1].Visible = True
Forms![Product List1].Requery
Forms![Product List1]![PartNumber].SetFocus
DoCmd.FindRecord Forms![frmChoose]![subChoose].[Form].Controls![PN]
DoCmd.Close acForm, frmChoose

What is causing this and how can I cure it?
 
May need a bit more info
Is the Forms![frmChoose]![subChoose].[Form].Controls![PN] a different form, sub form??

Use a msgbox to return values as you step through your code

I presume the line DoCmd.FindRecord Forms![frmChoose]![subChoose].[Form].Controls![PN] is returning the problem

Try
Msgbox Forms![frmChoose]![subChoose].[Form].Controls![PN]
and see what you get. Just use the ' to exclude the other lines for the moment
Dave
 
i tried putting in the message box like u suggested. It gave me the correct value from the subchoose subform on the frmchoose table that I wanted. It then opened the product list form at the correct record but still came up with the same message. Any other ideas??
 
hmmm... check Access help on the arg requirements of FindRecord. For some reason I have the nagging feeling that it wants an explicit expression or value, rather than a reference to something containing that value... something like

Code:
DoCmd.FindRecord ("" & Forms![frmChoose]![subChoose].[Form].Controls![PN], <other args...> )

Or something. Am I just crazy???

--Cloudy Mac
 
I don't know if this helps but I would code it: DoCmd.FindRecord Forms![frmChoose]![subChoose].[Form]![PN]
 

Users who are viewing this thread

Back
Top Bottom