Doug,
I can't get your control source method to work. My checkbox appears
grayed
out. There is also a problem with creating a relationship between table
Order Entry and table Process Codes that I didn't anticipate... The
ID_Process_Key field becomes required before you can exit from a new
record
or move to a different record. The workaround, I know, is to fill in the
text box with a value, but the way we enter data, sometimes we don't know
what the Process Code will be until later. Can you think of a way to
create
this conditional record source without this relationship being reuired?
It
seems to me that if the query behind the form does not find a match in the
Process Code table, that I should still be able to create a record in the
Order Entry table and scroll through records without filling in the
ID_Process_Key field. I've tried all three types of joins on the query,
but
can't seem to find one that will allow me to do this.
--
Why are you asking me? I dont know what Im doing!
Jaybird
Douglas J. Steele said:
That's certainly one way.
Another would be to set the control source to
=IIf([checkOpt120] = 1, [chkOpt120], [Tensile Test])
I'm assuming this isn't supposed to be a bound field.
--
Doug Steele, Microsoft Access MVP
(no private e-mails, please)
"Jaybird" <UMUhtq5013> wrote in message
I'm assuming that this conditional would be set by the On Current
event,
and
that it would look something like this?
If [chkOpt120]<>-1 then
Me.txtTensileTest = [Tensile Test]
Else
Me.txtTensileTest = [chkOpt120]
End if
--
Why are you asking me? I dont know what Im doing!
Jaybird
:
Your syntax looks correct. The issue is that DLookups can be
inefficient.
Add joins that give you the result of both of the DLookups in your
form's
recordsource, then use a IIf statement to decide which field to use.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
"Jaybird" <UMUhtq5013> wrote in message
Yes, I could. But what I'm trying to do is set up a conditional
record
source. If the value in one table is not 'yes', then the control
source
is
one DLookup. If the value is 'yes' then I want to set the control
source
to
another DLookup. This allows us to set a default value of 'yes' in
the
Tensile Test check box on the form when [chkOpt120] is checked in
the
Process Codes table. If [chkOpt120] is not checked, we may or may
not
want a
tensile test performed, so I want the control source to go the Order
Entry
table. I think my syntax of the DLookups is what's holding me back,
however.
--
Why are you asking me? I dont know what Im doing!
Jaybird
:
Can you not just join the existing recordsource to the [Order
Entry5]
table
so that you can avoid the DLookups?
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
"Jaybird" <UMUhtq5013> wrote in message
I can't seem to get my syntax right. I want a DLookup value on a
form
(a
checkbox). The table I want to lookup the value in is [Order
Entry5].
The
field I want to lookup is [Tensile Test]. The condition is where
the
Order
Number in the table is equal to the text box [txtOrder_Number] on
the
form,
which is called [Order Entry5]. What I came up with is :
=DLookUp("[Tensil Test]","[Order Entry5]","[Order Number] ='" &
[Forms]![Order Entry5]![txtOrder_Number] & "'")
The double quotes are because [txtOrder_Number] is actually text,
not a
number. The result is a persistant flicker in the checkbox when
I
open
the
form. What am I doing wrong?