Combo Box Columns

  • Thread starter Thread starter gjameson via AccessMonster.com
  • Start date Start date
G

gjameson via AccessMonster.com

I have a combo box on a login page which has 4 columns. Once the right user
id and password are entered the login page goes to a form that is unbound and
has a subform on it. The subform is supposed to show open tickets for the
person who logged in. I am having problems getting Column(3) from login to
the query that is to show their tickets. I have tried so many things I really
do not know where to go from here.

Query for login combo box:

SELECT tblEmployees.lngMyEmpID, tblEmployees.strWorkID, tblEmployees.
strEmpName, tblEmployees.strEmpID
FROM tblEmployees;


Query for subform:

SELECT [Maint Records].ID, [Maint Records].strEmpID, [Maint Records].
strWorkID, [Maint Records].[Date Issued], [Maint Records].Action, [Maint
Records].Problem, [Maint Records].[Date Resolved], [Maint Records].Status,
[Maint Records].[Ticket Number], [Maint Records].Notes
FROM tblEmployees INNER JOIN [Maint Records] ON tblEmployees.strEmpID =
[Maint Records].strEmpID
WHERE ((([Maint Records].strEmpID)=Forms!splash!cboEmployee.Column(3)))
ORDER BY [Maint Records].[Date Issued] DESC;

Help..................

TIA
Gerald
 
I don't believe SQL is capable of working with the Columns collection: it
simply doesn't know about VBA concepts like that.

You could try putting a hidden text box on the form, and populating it with
the contents of the combo box in its AfterUpdate event.
 
I think you can get by with an invisible text box with a control source of:
=cboEmployee.Column(3). Use the text box in your query criteria.

--
Duane Hookom
MS Access MVP


Douglas J. Steele said:
I don't believe SQL is capable of working with the Columns collection: it
simply doesn't know about VBA concepts like that.

You could try putting a hidden text box on the form, and populating it
with the contents of the combo box in its AfterUpdate event.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


gjameson via AccessMonster.com said:
I have a combo box on a login page which has 4 columns. Once the right
user
id and password are entered the login page goes to a form that is unbound
and
has a subform on it. The subform is supposed to show open tickets for the
person who logged in. I am having problems getting Column(3) from login
to
the query that is to show their tickets. I have tried so many things I
really
do not know where to go from here.

Query for login combo box:

SELECT tblEmployees.lngMyEmpID, tblEmployees.strWorkID, tblEmployees.
strEmpName, tblEmployees.strEmpID
FROM tblEmployees;


Query for subform:

SELECT [Maint Records].ID, [Maint Records].strEmpID, [Maint Records].
strWorkID, [Maint Records].[Date Issued], [Maint Records].Action, [Maint
Records].Problem, [Maint Records].[Date Resolved], [Maint
Records].Status,
[Maint Records].[Ticket Number], [Maint Records].Notes
FROM tblEmployees INNER JOIN [Maint Records] ON tblEmployees.strEmpID =
[Maint Records].strEmpID
WHERE ((([Maint Records].strEmpID)=Forms!splash!cboEmployee.Column(3)))
ORDER BY [Maint Records].[Date Issued] DESC;

Help..................

TIA
Gerald
 
Is Column(3) the third or fourth column in the query.
Remember columns in a query start at 0
 
I am using a text box on my login form with =cboEmployee.Column(3). This
works fine. It is displaying what I need. But this is not getting over to the
other sub-form with the query. I have a txt box on the form that the sub-form
is on and it shows the contents fine too. Is this a problem with having the
login form unbound? When I login and go to the other form it prompts me for
my txtStrID, I enter it and the sub-form query works.

So close.............

TIA
Gerald

Duane said:
I think you can get by with an invisible text box with a control source of:
=cboEmployee.Column(3). Use the text box in your query criteria.
I don't believe SQL is capable of working with the Columns collection: it
simply doesn't know about VBA concepts like that.
[quoted text clipped - 35 lines]
 
What do you mean by "getting over to the other sub-form with the query" and
what is txtStrID?


--
Duane Hookom
MS Access MVP

gjameson via AccessMonster.com said:
I am using a text box on my login form with =cboEmployee.Column(3). This
works fine. It is displaying what I need. But this is not getting over to
the
other sub-form with the query. I have a txt box on the form that the
sub-form
is on and it shows the contents fine too. Is this a problem with having
the
login form unbound? When I login and go to the other form it prompts me
for
my txtStrID, I enter it and the sub-form query works.

So close.............

TIA
Gerald

Duane said:
I think you can get by with an invisible text box with a control source
of:
=cboEmployee.Column(3). Use the text box in your query criteria.
I don't believe SQL is capable of working with the Columns collection: it
simply doesn't know about VBA concepts like that.
[quoted text clipped - 35 lines]
TIA
Gerald
 
Once the right user id and password are entered the login page that closes
and a form that is unbound and
has a subform is opened. The subform is supposed to show open tickets for the
person who logged in.

login form to maint form, with a subform, which is filtered by a query,
depending on who logged in on the login form

txtStrID is the hidden text box on my login form
[Forms]![Splash]![txtStrID] is the criteria in my query


Duane said:
What do you mean by "getting over to the other sub-form with the query" and
what is txtStrID?
I am using a text box on my login form with =cboEmployee.Column(3). This
works fine. It is displaying what I need. But this is not getting over to
[quoted text clipped - 21 lines]
 
Are you leaving the Splash form open?


--
Duane Hookom
MS Access MVP

gjameson via AccessMonster.com said:
Once the right user id and password are entered the login page that closes
and a form that is unbound and
has a subform is opened. The subform is supposed to show open tickets for
the
person who logged in.

login form to maint form, with a subform, which is filtered by a query,
depending on who logged in on the login form

txtStrID is the hidden text box on my login form
[Forms]![Splash]![txtStrID] is the criteria in my query


Duane said:
What do you mean by "getting over to the other sub-form with the query"
and
what is txtStrID?
I am using a text box on my login form with =cboEmployee.Column(3). This
works fine. It is displaying what I need. But this is not getting over
to
[quoted text clipped - 21 lines]
TIA
Gerald
 
Closing it when I goto the other form. Should I leave it open?

Duane said:
Are you leaving the Splash form open?
Once the right user id and password are entered the login page that closes
and a form that is unbound and
[quoted text clipped - 18 lines]
 
If you want to reference a control's value from the form, you must leave it
open. You can make it invisible by setting the form's visible property to
False.

--
Duane Hookom
MS Access MVP

gjameson via AccessMonster.com said:
Closing it when I goto the other form. Should I leave it open?

Duane said:
Are you leaving the Splash form open?
Once the right user id and password are entered the login page that
closes
and a form that is unbound and
[quoted text clipped - 18 lines]
TIA
Gerald
 
I left it open and it is still asking for that value.

Duane said:
If you want to reference a control's value from the form, you must leave it
open. You can make it invisible by setting the form's visible property to
False.
Closing it when I goto the other form. Should I leave it open?
[quoted text clipped - 6 lines]
 
Thanks for your help Duane. I must stress the importance of using the right
fields in 'Link Child and Master fields'. :) This is where my typo was. I was
still referencing the wrong field in one. Works great now.
I left it open and it is still asking for that value.
If you want to reference a control's value from the form, you must leave it
open. You can make it invisible by setting the form's visible property to
[quoted text clipped - 5 lines]
 
Back
Top