Trouble with control reference

  • Thread starter Slez via AccessMonster.com
  • Start date
S

Slez via AccessMonster.com

I have a control named "cboProjectMatl" on a form called "frmMainScreen" that
I am trying to reference as criteria in a query, but I get no results. I can
type in a desired JobNumber and the query retrieves the proper data, and the
control on the form works properly, so it seems to be something in between.

The SQL for my query is:
SELECT Project.JobNumber, Project.ProjectName, Project.ProjectID
FROM Project
WHERE (((Project.JobNumber)=[Forms]![frmMainScreen]![cboProjectMatl]));

I have other identically set up form controls and queries, and they have
always worked fine, so I am puzzled why I would have a problem with such a
simple reference. What might be some things I can look for that would cause
this issue?
Thank you!
 
K

KARL DEWEY

A couple of questions come to mind.
Is JobNumber a text or number field?
How many fields does cboProjectMatl produce? Maybe 2 - ProjectID and
JobNumber.
 
S

Slez via AccessMonster.com

Hi Karl,
JobNumber is a text field.

The RowSource for cboProjectMatl is this:
SELECT qryActiveProjects.ProjectID, qryActiveProjects.JobNumber,
qryActiveProjects.ProjectName FROM qryActiveProjects ORDER BY
qryActiveProjects.JobNumber;

Thanks
Slez

KARL said:
A couple of questions come to mind.
Is JobNumber a text or number field?
How many fields does cboProjectMatl produce? Maybe 2 - ProjectID and
JobNumber.
I have a control named "cboProjectMatl" on a form called "frmMainScreen" that
I am trying to reference as criteria in a query, but I get no results. I can
[quoted text clipped - 11 lines]
this issue?
Thank you!
 
K

KARL DEWEY

Your selection is trying to compare JobNumber with the combo ProjectID.
If there is a one-to-one relationship between JobNumber and ProjectID then
change query to this --

SELECT Project.JobNumber, Project.ProjectName, Project.ProjectID
FROM Project
WHERE (((Project.ProjectID)=[Forms]![frmMainScreen]![cboProjectMatl]));


--
Build a little, test a little.


Slez via AccessMonster.com said:
Hi Karl,
JobNumber is a text field.

The RowSource for cboProjectMatl is this:
SELECT qryActiveProjects.ProjectID, qryActiveProjects.JobNumber,
qryActiveProjects.ProjectName FROM qryActiveProjects ORDER BY
qryActiveProjects.JobNumber;

Thanks
Slez

KARL said:
A couple of questions come to mind.
Is JobNumber a text or number field?
How many fields does cboProjectMatl produce? Maybe 2 - ProjectID and
JobNumber.
I have a control named "cboProjectMatl" on a form called "frmMainScreen" that
I am trying to reference as criteria in a query, but I get no results. I can
[quoted text clipped - 11 lines]
this issue?
Thank you!
 
S

Slez via AccessMonster.com

Thanks Karl! It works!
I'm not sure if I understand how or why...is it because the RowSource for
cboProjectMatl lists ProjectID first?
Slez

KARL said:
Your selection is trying to compare JobNumber with the combo ProjectID.
If there is a one-to-one relationship between JobNumber and ProjectID then
change query to this --

SELECT Project.JobNumber, Project.ProjectName, Project.ProjectID
FROM Project
WHERE (((Project.ProjectID)=[Forms]![frmMainScreen]![cboProjectMatl]));
Hi Karl,
JobNumber is a text field.
[quoted text clipped - 17 lines]
 
K

KARL DEWEY

is it because the RowSource for cboProjectMatl lists ProjectID first?
Yes.
--
Build a little, test a little.


Slez via AccessMonster.com said:
Thanks Karl! It works!
I'm not sure if I understand how or why...is it because the RowSource for
cboProjectMatl lists ProjectID first?
Slez

KARL said:
Your selection is trying to compare JobNumber with the combo ProjectID.
If there is a one-to-one relationship between JobNumber and ProjectID then
change query to this --

SELECT Project.JobNumber, Project.ProjectName, Project.ProjectID
FROM Project
WHERE (((Project.ProjectID)=[Forms]![frmMainScreen]![cboProjectMatl]));
Hi Karl,
JobNumber is a text field.
[quoted text clipped - 17 lines]
this issue?
Thank you!
 

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

Top