Query on Current User

D

Debbie

How do I create a criteria within my query that shows current user logged
into a form?

I have created a form that allows whomever is logged in to populate and it
reads that the current user no problem. Form is perfect but I want to create
a report that shows only the current users information when they are logged
on.

I thought I had to just create a query and my criteria would be
"=CurrentUser()"

Deb.
 
B

Brian

Try creating a hidden text box (e.g. txtBoxUser) on your form, and set its
default value to CurrentUser(). Then you can enter the criteria in the query
like this:

[Forms]![yourForm]![txtBoxUser]
 
D

Debbie

I'm not sure where to place this on the query. The form is feeding a master
table and I set in my form the default values for Account Manager to be
"CurrentUser()".

So in my query I thought under Account Manager I would set the query to be
"CurrentUser()" and then my report would only roll up that specific
information on the Current User logged in.

Maybe this makes more sense. Account Manager logs into database, Enters
information into the Form then should be able to click on the button to run
their information only. I don't want my Account Managers to be able to view
each others information within the report. Is there a way to set it where
they can only see their information (that is why I set it to "currentuser()"
logon).

Did that make any sense?

Thanks for your quick response!

Deb

Brian said:
Try creating a hidden text box (e.g. txtBoxUser) on your form, and set its
default value to CurrentUser(). Then you can enter the criteria in the query
like this:

[Forms]![yourForm]![txtBoxUser]

Debbie said:
How do I create a criteria within my query that shows current user logged
into a form?

I have created a form that allows whomever is logged in to populate and it
reads that the current user no problem. Form is perfect but I want to create
a report that shows only the current users information when they are logged
on.

I thought I had to just create a query and my criteria would be
"=CurrentUser()"

Deb.
 
B

Brian

Assuming that AccountManager is one of the fields in the table as well as the
name of a control (text box?) on your form, and that there will be a
CurrentUser that matches each AccountManager exactly, you can just put this
in the criteria of the AccountManager field in the query underlying the form
(i.e. in its RecordSource) and/or report:

[Forms]![yourFormName]![AccountManager]


Debbie said:
I'm not sure where to place this on the query. The form is feeding a master
table and I set in my form the default values for Account Manager to be
"CurrentUser()".

So in my query I thought under Account Manager I would set the query to be
"CurrentUser()" and then my report would only roll up that specific
information on the Current User logged in.

Maybe this makes more sense. Account Manager logs into database, Enters
information into the Form then should be able to click on the button to run
their information only. I don't want my Account Managers to be able to view
each others information within the report. Is there a way to set it where
they can only see their information (that is why I set it to "currentuser()"
logon).

Did that make any sense?

Thanks for your quick response!

Deb

Brian said:
Try creating a hidden text box (e.g. txtBoxUser) on your form, and set its
default value to CurrentUser(). Then you can enter the criteria in the query
like this:

[Forms]![yourForm]![txtBoxUser]

Debbie said:
How do I create a criteria within my query that shows current user logged
into a form?

I have created a form that allows whomever is logged in to populate and it
reads that the current user no problem. Form is perfect but I want to create
a report that shows only the current users information when they are logged
on.

I thought I had to just create a query and my criteria would be
"=CurrentUser()"

Deb.
 
D

Debbie

Hi Brian:

I've tried the things you have suggested it isn't working. I went to my form
and created a hidden text box using your suggestion but where in my query do
I put the formula to search the form?

[Forms]![frmMaster]![txtBoxUser]

Brian said:
Assuming that AccountManager is one of the fields in the table as well as the
name of a control (text box?) on your form, and that there will be a
CurrentUser that matches each AccountManager exactly, you can just put this
in the criteria of the AccountManager field in the query underlying the form
(i.e. in its RecordSource) and/or report:

[Forms]![yourFormName]![AccountManager]


Debbie said:
I'm not sure where to place this on the query. The form is feeding a master
table and I set in my form the default values for Account Manager to be
"CurrentUser()".

So in my query I thought under Account Manager I would set the query to be
"CurrentUser()" and then my report would only roll up that specific
information on the Current User logged in.

Maybe this makes more sense. Account Manager logs into database, Enters
information into the Form then should be able to click on the button to run
their information only. I don't want my Account Managers to be able to view
each others information within the report. Is there a way to set it where
they can only see their information (that is why I set it to "currentuser()"
logon).

Did that make any sense?

Thanks for your quick response!

Deb

Brian said:
Try creating a hidden text box (e.g. txtBoxUser) on your form, and set its
default value to CurrentUser(). Then you can enter the criteria in the query
like this:

[Forms]![yourForm]![txtBoxUser]

:

How do I create a criteria within my query that shows current user logged
into a form?

I have created a form that allows whomever is logged in to populate and it
reads that the current user no problem. Form is perfect but I want to create
a report that shows only the current users information when they are logged
on.

I thought I had to just create a query and my criteria would be
"=CurrentUser()"

Deb.
 
B

Brian

This ([Forms]![frmMaster]![txtBoxUser]) goes in the criteria section for the
AccountManager field in the form's RecordSource query. I am assuming two
things:

1. AccountManager is one of the fields in the master table
2. There is an AccountManager entry that matches exactly each CurrentUser

If either or both is not true, then you have nothing in your table that
matches the Current User, and therefore no way to limit the data to that
which matches the CurrentUser.

Try posting the entire SQL of the form's record source if necessary.

Debbie said:
Hi Brian:

I've tried the things you have suggested it isn't working. I went to my form
and created a hidden text box using your suggestion but where in my query do
I put the formula to search the form?

[Forms]![frmMaster]![txtBoxUser]

Brian said:
Assuming that AccountManager is one of the fields in the table as well as the
name of a control (text box?) on your form, and that there will be a
CurrentUser that matches each AccountManager exactly, you can just put this
in the criteria of the AccountManager field in the query underlying the form
(i.e. in its RecordSource) and/or report:

[Forms]![yourFormName]![AccountManager]


Debbie said:
I'm not sure where to place this on the query. The form is feeding a master
table and I set in my form the default values for Account Manager to be
"CurrentUser()".

So in my query I thought under Account Manager I would set the query to be
"CurrentUser()" and then my report would only roll up that specific
information on the Current User logged in.

Maybe this makes more sense. Account Manager logs into database, Enters
information into the Form then should be able to click on the button to run
their information only. I don't want my Account Managers to be able to view
each others information within the report. Is there a way to set it where
they can only see their information (that is why I set it to "currentuser()"
logon).

Did that make any sense?

Thanks for your quick response!

Deb

:

Try creating a hidden text box (e.g. txtBoxUser) on your form, and set its
default value to CurrentUser(). Then you can enter the criteria in the query
like this:

[Forms]![yourForm]![txtBoxUser]

:

How do I create a criteria within my query that shows current user logged
into a form?

I have created a form that allows whomever is logged in to populate and it
reads that the current user no problem. Form is perfect but I want to create
a report that shows only the current users information when they are logged
on.

I thought I had to just create a query and my criteria would be
"=CurrentUser()"

Deb.
 
Top