Tabsysem

  • Thread starter Datakonsulenten
  • Start date
D

Datakonsulenten

When I am using Dlookup in a form, it wont work when I use the same form in a
tabsystem as a subform. Works fine as a single form, but show an error when
used on a tab.
 
D

Douglas J Steele

Is your DLookup trying to refer to a field on the form? If so, how is it
doing so?
 
D

Datakonsulenten

I use Dlookup to find a town/postalcode in a table with postalcodes and towns
so
you either know the postal code or the town and the approbiate field in a
form is updated.
DLookUp("[By]";"Postoversigt";"
Forms![FormTAB1]![DebitorPostnr]=[Postoversigt]![Postnr]")
 
D

Douglas J Steele

Unfortunately, when a form is being used as a subform, you have to change
how you refer to controls on it.

As far as Access is concerned, FormTAB1 isn't open when it's being used as a
subform. To refer to a control on a form being used as a subform, you need
to use

Forms!NameOfParentForm!NameOfSubformContainer.Form!NameOfControl

Note that NameOfSubformContainer may or may not be the same as the name of
the form being used as a subform. If you created the form/subform
relationship by dragging FormTAB1 onto its parent form, then odds are that
the subform container will be named FormTAB1 (unless you already had a
control with that name on the parent form). However, if you created the
form/subform relationship by adding a subform container from the tool box
and providing the necessary information (either manually or using the
wizard), odds are the subform container is going to be named something like
Child0 (where the numeber 0 will vary)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Datakonsulenten said:
I use Dlookup to find a town/postalcode in a table with postalcodes and towns
so
you either know the postal code or the town and the approbiate field in a
form is updated.
DLookUp("[By]";"Postoversigt";"
Forms![FormTAB1]![DebitorPostnr]=[Postoversigt]![Postnr]")

--
Datakons


Douglas J Steele said:
Is your DLookup trying to refer to a field on the form? If so, how is it
doing so?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


form
in a
 
D

Datakonsulenten

Thank you very much Douglas , now it works. And I did use the tool box and
still it accepted the true name of the form. It has bothered me for 14 days
and I am glad I found this way to a solution. Hans Christian.
--
Datakons


Douglas J Steele said:
Unfortunately, when a form is being used as a subform, you have to change
how you refer to controls on it.

As far as Access is concerned, FormTAB1 isn't open when it's being used as a
subform. To refer to a control on a form being used as a subform, you need
to use

Forms!NameOfParentForm!NameOfSubformContainer.Form!NameOfControl

Note that NameOfSubformContainer may or may not be the same as the name of
the form being used as a subform. If you created the form/subform
relationship by dragging FormTAB1 onto its parent form, then odds are that
the subform container will be named FormTAB1 (unless you already had a
control with that name on the parent form). However, if you created the
form/subform relationship by adding a subform container from the tool box
and providing the necessary information (either manually or using the
wizard), odds are the subform container is going to be named something like
Child0 (where the numeber 0 will vary)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Datakonsulenten said:
I use Dlookup to find a town/postalcode in a table with postalcodes and towns
so
you either know the postal code or the town and the approbiate field in a
form is updated.
DLookUp("[By]";"Postoversigt";"
Forms![FormTAB1]![DebitorPostnr]=[Postoversigt]![Postnr]")

--
Datakons


Douglas J Steele said:
Is your DLookup trying to refer to a field on the form? If so, how is it
doing so?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


When I am using Dlookup in a form, it wont work when I use the same form
in a
tabsystem as a subform. Works fine as a single form, but show an error
when
used on a tab.
 
T

TAJ

This was AWESOME info!! I have been fighting with this exact problem myself
and it worked like a charm! Now I can sleep good tonight!

Datakonsulenten said:
Thank you very much Douglas , now it works. And I did use the tool box and
still it accepted the true name of the form. It has bothered me for 14 days
and I am glad I found this way to a solution. Hans Christian.
--
Datakons


Douglas J Steele said:
Unfortunately, when a form is being used as a subform, you have to change
how you refer to controls on it.

As far as Access is concerned, FormTAB1 isn't open when it's being used as a
subform. To refer to a control on a form being used as a subform, you need
to use

Forms!NameOfParentForm!NameOfSubformContainer.Form!NameOfControl

Note that NameOfSubformContainer may or may not be the same as the name of
the form being used as a subform. If you created the form/subform
relationship by dragging FormTAB1 onto its parent form, then odds are that
the subform container will be named FormTAB1 (unless you already had a
control with that name on the parent form). However, if you created the
form/subform relationship by adding a subform container from the tool box
and providing the necessary information (either manually or using the
wizard), odds are the subform container is going to be named something like
Child0 (where the numeber 0 will vary)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Datakonsulenten said:
I use Dlookup to find a town/postalcode in a table with postalcodes and towns
so
you either know the postal code or the town and the approbiate field in a
form is updated.
DLookUp("[By]";"Postoversigt";"
Forms![FormTAB1]![DebitorPostnr]=[Postoversigt]![Postnr]")

--
Datakons


:

Is your DLookup trying to refer to a field on the form? If so, how is it
doing so?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


When I am using Dlookup in a form, it wont work when I use the same form
in a
tabsystem as a subform. Works fine as a single form, but show an error
when
used on a tab.
 
Top