T
Tony Williams
I'm reposting this question as I recognise that I didn't give enough
explanation in my first post. So here is the full story.
I have a combobox control (cmbstatus) on a subform (frmvehicle) which is on
a form (frmMain). The control source of cmbstatus is txtstatus of my main
table and the row source is a value List as this - "01";"02";"91";"92".
Although they are numbers, txtstatus is a text field because I wanted to
force the leading 0's.
On the same subform is an unbound control (txtstatusdesc). I want this value
to equal the value of a field also called txtstatus that is held in a table
called StatusCodes and where the the value of cmbstatus on my subform equals
the value of txtstatuscode in the StatusCode table.
I had the control source as :
=DLookUp("[txtstatus]","[StatusCodes]","[txtstatuscode]=Forms![frmMain]![frmVehicle].Form![cmbstatus]")
but this gave me an #Error that blinked. So Daniel, in my previous post,
gave me this:
=DLookUp("[txtstatus]","[StatusCodes]","[txtstatuscode]='" &
[Forms]![frmMain]![frmVehicle].[Form]![cmbstatus] & "'")
But this gives me a #Name?
I thought my original formula follwed the correct protocol for referring to
controls on subforms. I've also tried:
1. using the control source txtstatus instead of the control name cmbstatus
in the formula
2. leaving the control source of the unbound control txtstatusdesc on the
sub form blank and putting the DLookUp formula in the Default value but I
still get the same problems
I've checked my spelling of the field and table names and they are correct.
This is really frustrating as I thought I was foing the right thing with the
formula and I don't know what else to do.
Could someone please help?
Thanks
Tony
explanation in my first post. So here is the full story.
I have a combobox control (cmbstatus) on a subform (frmvehicle) which is on
a form (frmMain). The control source of cmbstatus is txtstatus of my main
table and the row source is a value List as this - "01";"02";"91";"92".
Although they are numbers, txtstatus is a text field because I wanted to
force the leading 0's.
On the same subform is an unbound control (txtstatusdesc). I want this value
to equal the value of a field also called txtstatus that is held in a table
called StatusCodes and where the the value of cmbstatus on my subform equals
the value of txtstatuscode in the StatusCode table.
I had the control source as :
=DLookUp("[txtstatus]","[StatusCodes]","[txtstatuscode]=Forms![frmMain]![frmVehicle].Form![cmbstatus]")
but this gave me an #Error that blinked. So Daniel, in my previous post,
gave me this:
=DLookUp("[txtstatus]","[StatusCodes]","[txtstatuscode]='" &
[Forms]![frmMain]![frmVehicle].[Form]![cmbstatus] & "'")
But this gives me a #Name?
I thought my original formula follwed the correct protocol for referring to
controls on subforms. I've also tried:
1. using the control source txtstatus instead of the control name cmbstatus
in the formula
2. leaving the control source of the unbound control txtstatusdesc on the
sub form blank and putting the DLookUp formula in the Default value but I
still get the same problems
I've checked my spelling of the field and table names and they are correct.
This is really frustrating as I thought I was foing the right thing with the
formula and I don't know what else to do.
Could someone please help?
Thanks
Tony