Goto Control - syntax for argument

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that I created from a query based on two tables.
Both tables have a field called "last defect"
Usually when I create a macro in the form and I use the GotoControl command,
I can type as the argument for the Goto Control action as [last defect],
using the square brackets.
But since I have two controls on the form called "last defect", I don't know
the
correct syntax for the argument.
The error says that "there is no field named last defect in the current
record".

I tried using the syntax that works in the condition statement for the
action, which is "TBL_OLD.last defect", I tried referring to the query or the
form first, and then both,using square brackets and " " but no luck.
What is the syntax used in the argument field?
Thanks in advance for your help!
 
Your 2 controls will have different names. Use the correct name in your
macro.


Open the form in design view, right-click the control and choose Properties.
On the Other tab of the Properties box you will see the Name property.
 
S.O.S said:
I have a form that I created from a query based on two tables.
Both tables have a field called "last defect"
Usually when I create a macro in the form and I use the GotoControl
command,
I can type as the argument for the Goto Control action as [last defect],
using the square brackets.
But since I have two controls on the form called "last defect", I don't
know
the
correct syntax for the argument.
The error says that "there is no field named last defect in the current
record".

You can't have two controls named the same thing on a single form.
Don't confuse the record source with the name of the control.

Tom Lake
 
Hi Allen,

Actually, I did that orginally. Since I used a query to design my form,
the name of that field is TBL_OLD.Last Defect. In the other Last Defect
field (from the other table), the name of that field is TBL_NEW.Last Defect.

So I did try to type in TBL_OLD.Last Defect, then I tried "TBL_OLD.Last
Defect", then [TBL_OLD.Last Defect], then TBL_OLD![Last Defect]. But none of
these syntax formats worked.

Allen Browne said:
Your 2 controls will have different names. Use the correct name in your
macro.


Open the form in design view, right-click the control and choose Properties.
On the Other tab of the Properties box you will see the Name property.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

S.O.S said:
I have a form that I created from a query based on two tables.
Both tables have a field called "last defect"
Usually when I create a macro in the form and I use the GotoControl
command,
I can type as the argument for the Goto Control action as [last defect],
using the square brackets.
But since I have two controls on the form called "last defect", I don't
know
the
correct syntax for the argument.
The error says that "there is no field named last defect in the current
record".

I tried using the syntax that works in the condition statement for the
action, which is "TBL_OLD.last defect", I tried referring to the query or
the
form first, and then both,using square brackets and " " but no luck.
What is the syntax used in the argument field?
Thanks in advance for your help!
 
There is a difference between the Name of the text box, and the Control
Source of the text box.

The Name is what you refer to it as.
The Control Source is the name of the field it is bound to.
On many forms, these two properties might be the same.
But Access will not allow you to have two text boxes with the same name on
one form.

Go back to the previous reply, and follow the steps to find out what the
Name of your text box is.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

S.O.S said:
Hi Allen,

Actually, I did that orginally. Since I used a query to design my form,
the name of that field is TBL_OLD.Last Defect. In the other Last Defect
field (from the other table), the name of that field is TBL_NEW.Last
Defect.

So I did try to type in TBL_OLD.Last Defect, then I tried "TBL_OLD.Last
Defect", then [TBL_OLD.Last Defect], then TBL_OLD![Last Defect]. But none
of
these syntax formats worked.

Allen Browne said:
Your 2 controls will have different names. Use the correct name in your
macro.


Open the form in design view, right-click the control and choose
Properties.
On the Other tab of the Properties box you will see the Name property.

S.O.S said:
I have a form that I created from a query based on two tables.
Both tables have a field called "last defect"
Usually when I create a macro in the form and I use the GotoControl
command,
I can type as the argument for the Goto Control action as [last
defect],
using the square brackets.
But since I have two controls on the form called "last defect", I don't
know
the
correct syntax for the argument.
The error says that "there is no field named last defect in the current
record".

I tried using the syntax that works in the condition statement for the
action, which is "TBL_OLD.last defect", I tried referring to the query
or
the
form first, and then both,using square brackets and " " but no luck.
What is the syntax used in the argument field?
Thanks in advance for your help!
 
There is a difference between the Name of the text box, and the Control
Source of the text box.

The Name is what you refer to it as.
The Control Source is the name of the field it is bound to.
On many forms, these two properties might be the same.
But Access will not allow you to have two text boxes with the same name on
one form.

Go back to the previous reply, and follow the steps to find out what the
Name of your text box is.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

S.O.S said:
Hi Allen,

Actually, I did that orginally. Since I used a query to design my form,
the name of that field is TBL_OLD.Last Defect. In the other Last Defect
field (from the other table), the name of that field is TBL_NEW.Last
Defect.

So I did try to type in TBL_OLD.Last Defect, then I tried "TBL_OLD.Last
Defect", then [TBL_OLD.Last Defect], then TBL_OLD![Last Defect]. But none
of
these syntax formats worked.

Allen Browne said:
Your 2 controls will have different names. Use the correct name in your
macro.


Open the form in design view, right-click the control and choose
Properties.
On the Other tab of the Properties box you will see the Name property.

S.O.S said:
I have a form that I created from a query based on two tables.
Both tables have a field called "last defect"
Usually when I create a macro in the form and I use the GotoControl
command,
I can type as the argument for the Goto Control action as [last
defect],
using the square brackets.
But since I have two controls on the form called "last defect", I don't
know
the
correct syntax for the argument.
The error says that "there is no field named last defect in the current
record".

I tried using the syntax that works in the condition statement for the
action, which is "TBL_OLD.last defect", I tried referring to the query
or
the
form first, and then both,using square brackets and " " but no luck.
What is the syntax used in the argument field?
Thanks in advance for your help!
 
Back
Top