Referencing fields on a sub form from another form

G

Guest

Hi,

I have a subform (SubFrmA) on a main form (FormA). I have a combo box on
the subform. In the Not In List property of the combo box I have an Event
Procedure which advises the user that the selection they've just made is not
in the list, and would they like to update the table which drives the combo
box. If the user selects yes, another form (FormUpdate) is opened, which is
simply the aforementioned table in continuous form view. The user can also
access FormUpdate through a switchboard from.

I'd like to have certain buttons enabled and properties set depending on how
the user accesses FormUpdate. If through the main switchboard then the form
would have all its buttons enabled and would open as DataEntry = No. If
through the Not In List event then the Add New Record would be disabled
(because I've already set this property to Yes using the DoCmd.OpenForms
method in the Not In List event).

What I'd done is this: I've placed an unbound field (txtUnbound) on SubFrmA.
In the NotInList event, when the user clicks Yes, prior to opening the
FormUpdate form the event runs a macro which uses the SetValue command to set
a value of 1 in the unbound field. Then, in the OnOpen event of FormUpdate I
have an IF statement which enables/disables the AddNewRecords button if the
unbound field on SubFrmA = 1. I'm having trouble doing this - I get a
message stating something along the lines of what I trying to do is not
supported. Here's how I'm referencing the txtUnbound field:

If Forms!FormA.SubFormA.txtUnbound = 1 then

Do I have the syntax right? How do I reference a field on other
form/subforms from a form?

Any help would be appreciated.

Thanks,
Manuel
 
G

Guest

Hi Manuel

Try this

If (Forms!FormA!SubFormA.Form!TxtUnbound = 1) Then
Somthing Here
Else
Somthing Else
End If

This would be a reference from the main form (FormA) to a field on the
subform (SubFormA)


--
Wayne
Manchester, England.
Enjoy whatever it is you do
Scusate,ma il mio Inglese fa schiffo :)
Percio se non ci siamo capiti, mi mandate un
messagio e provero di spiegarmi meglio.
 

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