Persistant flicker in DLookup

G

Guest

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?
 
D

Douglas J. Steele

Can you not just join the existing recordsource to the [Order Entry5] table
so that you can avoid the DLookups?
 
G

Guest

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


Douglas J. Steele said:
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 said:
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?
 
D

Douglas J. Steele

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 said:
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


Douglas J. Steele said:
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 said:
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?
 
G

Guest

THAT... is an excellent idea! I'll try it and let you know...
--
Why are you asking me? I dont know what Im doing!

Jaybird


Douglas J. Steele said:
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 said:
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


Douglas J. Steele said:
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?
 
G

Guest

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


Douglas J. Steele said:
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 said:
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


Douglas J. Steele said:
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?
 
D

Douglas J. Steele

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 said:
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


Douglas J. Steele said:
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 said:
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?
 
G

Guest

Thanks, Doug! I don't anticipate the method I described causing any
problems, but if it does, I'll use the method you laid out.
--
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 said:
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


Douglas J. Steele said:
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?
 
G

Guest

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 said:
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


Douglas J. Steele said:
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?
 
D

Douglas J. Steele

For what type of control are you trying to set the ControlSource property?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Jaybird said:
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 said:
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?
 
G

Guest

It's a checkbox. I'm not sure that it matters now, however... The method
for solving my problem I described earlier seems to work. Can you think of
any potential pitfalls with that method?
--
Why are you asking me? I dont know what Im doing!

Jaybird


Douglas J. Steele said:
For what type of control are you trying to set the ControlSource property?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Jaybird said:
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?
 

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

Similar Threads

Can't Enter New Record in Subform 4
DLookup as Batch Number? 12
Help with fConcatChild 2
VLOOKUP in a macro?? 4
dlookup 2
Trouble with DLookup 3
Dlookup 7
DLookup help 6

Top