Locating a Control

  • Thread starter Thread starter Deb Roberts
  • Start date Start date
D

Deb Roberts

I have an error message on a form that requires a value for a combo box. As
far as I can tell, the combo box has long since been deleted, but the form
is looking for it and/or it's value.

Is there any way to get a list of all controls and their locations??

Cheers & thanks.

Deb Roberts
 
In form design view, the Formatting toolbar has a drop-down list of controls
at the left end. Choose the control by name, and Access sets focus to it.

If you want to list them programmatically:

Dim ctl As Control
For Each ctl In Me.Controls
Debug.Print ctl.Name, ctl.Left / 1440, ctl.Top / 1440
Next
 
Do you have a class module attached to the form?
This is sometimes the case, with code referencing the control, &
subsequently erroring.

If your 'error' is an "Enter Parameter value" then you have some SQL
somewhere (possibly for a combo or listbox control) which references the
missing control...
 
James
I think this is exactly what is happening. The error is "Enter Parameter
Value", but I can't find any code that references the combo box either.
I've manually looked everyhwere I can think of.

Any other suggestions??

Deb
 
Hi Allen

I know about the drop down box, and the control is not listed in there.
This makes me think either it's coded somewhere, or it's actually on another
form as I have lots of subforms and linked forms.

WIll try the programatic approach, but if you have any other suggestions I'm
really stuck on this one.

Cheers

Deb
 
If you are working with a recent version of Access, and you are really stuck
to find the control, you could loop through the AllForms collection. Open
each in design view, and loop through its controls until you find the
desired control.
 
Ah, if it's asking for a parameter value, then it is not the name of a
control.

This could happen if:
- there is a field in form's source query that is misspelt;

- there is something in the form's Filter or OrderBy property that doesn't
match a field name;

- there is something in the Control Source of a control (not its name) that
doesn't match a field.
 
I think I've tried all of these areas, but I'll look again !! This is just
driving me mad - I'm going round & round in circles.

I have actually identified what causes the error, but still can't see why...

I have a form with a list of contact details called ContactsSearch
On this form there is a button - cmdGO which opens another form called
ContactsOverview
If the button simply opens the ContactsOverview form, I don't get the
message.
However, if I add [ContactsSearch].[contact id] =
[ContactsOverview].[contact id] into the "where" part of the macro, I then
get the error message.

I am adding the [contact id] = [contact id] where statement so that a user
can select a contact from the first form (which is purely a list of names),
and then see their complete details in the ContactsOverview form.

Not sure if this helps you to help me, or makes it worse, but again I really
appreciate the assistance.

Kind regards

Deb Roberts
 
The button cmdGo on form ContactsSearch has its On Click event set to a
macro. The macro uses the OpenForm action.

In the lower pane of the maco, you need something like this:

Form Name ContactsOverview
View Form
Filter Name
Where Condition [contact id] = [Forms]![ContactsSearch]![contact id]

That WhereCondition asks the form to load where its [contact id] field is
limited to the value of the [contact id] control on the ContactsSearch form.

If that does not solve the problem, please post the exact wording of the
Parameter dialog.

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

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

Deb Roberts said:
I think I've tried all of these areas, but I'll look again !! This is just
driving me mad - I'm going round & round in circles.

I have actually identified what causes the error, but still can't see why...

I have a form with a list of contact details called ContactsSearch
On this form there is a button - cmdGO which opens another form called
ContactsOverview
If the button simply opens the ContactsOverview form, I don't get the
message.
However, if I add [ContactsSearch].[contact id] =
[ContactsOverview].[contact id] into the "where" part of the macro, I then
get the error message.

I am adding the [contact id] = [contact id] where statement so that a user
can select a contact from the first form (which is purely a list of names),
and then see their complete details in the ContactsOverview form.

Not sure if this helps you to help me, or makes it worse, but again I really
appreciate the assistance.

Kind regards

Deb Roberts

Allen Browne said:
Ah, if it's asking for a parameter value, then it is not the name of a
control.

This could happen if:
- there is a field in form's source query that is misspelt;

- there is something in the form's Filter or OrderBy property that doesn't
match a field name;

- there is something in the Control Source of a control (not its name) that
doesn't match a field.

combo
box.
 
Thanks to all who responded to my calls for help here. I found the
problem - it was in the "Order By" property of the form.

Thanks again.

Deb


Allen Browne said:
The button cmdGo on form ContactsSearch has its On Click event set to a
macro. The macro uses the OpenForm action.

In the lower pane of the maco, you need something like this:

Form Name ContactsOverview
View Form
Filter Name
Where Condition [contact id] = [Forms]![ContactsSearch]![contact id]

That WhereCondition asks the form to load where its [contact id] field is
limited to the value of the [contact id] control on the ContactsSearch form.

If that does not solve the problem, please post the exact wording of the
Parameter dialog.

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

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

Deb Roberts said:
I think I've tried all of these areas, but I'll look again !! This is just
driving me mad - I'm going round & round in circles.

I have actually identified what causes the error, but still can't see why...

I have a form with a list of contact details called ContactsSearch
On this form there is a button - cmdGO which opens another form called
ContactsOverview
If the button simply opens the ContactsOverview form, I don't get the
message.
However, if I add [ContactsSearch].[contact id] =
[ContactsOverview].[contact id] into the "where" part of the macro, I then
get the error message.

I am adding the [contact id] = [contact id] where statement so that a user
can select a contact from the first form (which is purely a list of names),
and then see their complete details in the ContactsOverview form.

Not sure if this helps you to help me, or makes it worse, but again I really
appreciate the assistance.

Kind regards

Deb Roberts

Allen Browne said:
Ah, if it's asking for a parameter value, then it is not the name of a
control.

This could happen if:
- there is a field in form's source query that is misspelt;

- there is something in the form's Filter or OrderBy property that doesn't
match a field name;

- there is something in the Control Source of a control (not its name) that
doesn't match a field.

James
I think this is exactly what is happening. The error is "Enter Parameter
Value", but I can't find any code that references the combo box either.
I've manually looked everyhwere I can think of.

Any other suggestions??

Deb

Do you have a class module attached to the form?
This is sometimes the case, with code referencing the control, &
subsequently erroring.

If your 'error' is an "Enter Parameter value" then you have some SQL
somewhere (possibly for a combo or listbox control) which
references
the
missing control...



--
Cheers,


James Goodman
I have an error message on a form that requires a value for a combo
box.
As
far as I can tell, the combo box has long since been deleted,
but
the
form
is looking for it and/or it's value.

Is there any way to get a list of all controls and their locations??

Cheers & thanks.

Deb Roberts
 
Back
Top