trouble with tabs

C

Chris

I would like the value of the ClientID in my subform (on Page1) of the tab
to = the ClientID of the client selected in my main form.

Scenario.

User Goes to main form
Selects Client
Clicks button to take user to a new form (Containing tabs)
Tab opens with subform of the clients details.

Code that I'm trying to use is this
DoCmd.OpenForm stDocName, , , stLinkCriteria

stLinkCriteria = "[ClientID]=" & Me![MainFormName].Form![ClientID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

The error message I receive is "DB can't find the field "MainFormName"
refered to in your expression"

I posted a similar message on Friday which more clearly covers what am
attempting.

Please help me!
 
E

Ed Robichaud

I'm pretty sure the problem is in your form name references. "Me!" is the
same as Forms!myFormName, so choose to use one or the other. (BTW,
"Parent!" is the equivalent when referring to sub form controls. The Access
Help file and/or expression builder will help you.
-Ed
 
J

John Vinson

I would like the value of the ClientID in my subform (on Page1) of the tab
to = the ClientID of the client selected in my main form.

Scenario.

User Goes to main form
Selects Client
Clicks button to take user to a new form (Containing tabs)
Tab opens with subform of the clients details.

Code that I'm trying to use is this
DoCmd.OpenForm stDocName, , , stLinkCriteria

stLinkCriteria = "[ClientID]=" & Me![MainFormName].Form![ClientID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

The error message I receive is "DB can't find the field "MainFormName"
refered to in your expression"

Two problems that I see:

- Unless you've defined it somewhere else, you're not setting
stDocName to the name of the form you want to open.

- The criterion is ill-formed. If your criterion is in a control named
ClientID on a subform, you need the name *of the Subform control*
containing that subform; this might or might not be the same as the
name of the form within that control. E.g.

"[ClientID] = " & Me![subformcontrol].Form!ClientID

The main form (if that's what you mean by mainformname) does not have
a Form property - if the control ClientID is on the mainform, all you
need is

"[ClientID] = " & Me.ClientID
 

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