A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Form that Runs a Query.



 
 
Thread Tools Display Modes
  #1  
Old October 27th, 2009, 02:56 PM posted to microsoft.public.access.forms
chris
external usenet poster
 
Posts: 2,039
Default Form that Runs a Query.

I have set up a Form that has a combo box. When something in selected in the
combo box it automatically runs a query. The problem that I am having is
that I don't believe that the query is picking up the name correctly. The
query is designed to grab a name form a table(The name may be listed several
different times) and show a report of everything that related to that name.
However when the query is run it just has a blank report as if it doesn't
recgonize the name. I will post the SQL of the query but if there is
something else that I would need to post for help please let me know.

SELECT Users.UserName, CompleteList.DirectoryName
FROM Users INNER JOIN CompleteList ON Users.UsersID = CompleteList.UserName
WHERE (((Users.UserName)=[Forms]![PersonAccess]![cboSearch]));
  #2  
Old October 27th, 2009, 05:58 PM posted to microsoft.public.access.forms
NG
external usenet poster
 
Posts: 56
Default Form that Runs a Query.

You could try:

SELECT Users.UserName, CompleteList.DirectoryName
FROM Users INNER JOIN CompleteList ON Users.UsersID = CompleteList.UserName
WHERE Users.UserName = """ & [Forms]![PersonAccess]![cboSearch] & """"

kind regards
NG

"Chris" wrote:

I have set up a Form that has a combo box. When something in selected in the
combo box it automatically runs a query. The problem that I am having is
that I don't believe that the query is picking up the name correctly. The
query is designed to grab a name form a table(The name may be listed several
different times) and show a report of everything that related to that name.
However when the query is run it just has a blank report as if it doesn't
recgonize the name. I will post the SQL of the query but if there is
something else that I would need to post for help please let me know.

SELECT Users.UserName, CompleteList.DirectoryName
FROM Users INNER JOIN CompleteList ON Users.UsersID = CompleteList.UserName
WHERE (((Users.UserName)=[Forms]![PersonAccess]![cboSearch]));

  #3  
Old October 27th, 2009, 07:36 PM posted to microsoft.public.access.forms
J_Goddard via AccessMonster.com
external usenet poster
 
Posts: 221
Default Form that Runs a Query.

Hi -

What are the columns in the combo box, are they all visible, and which column
is the combo box bound to? Depending on how you set up the combo box, you
may see a person's name (for example), while the combo box value ([Forms]!
[PersonAccess]![cboSearch] in your case) is an invisible person ID number.

This is where I would start to look to fix the problem

HTH

John



Chris wrote:
I have set up a Form that has a combo box. When something in selected in the
combo box it automatically runs a query. The problem that I am having is
that I don't believe that the query is picking up the name correctly. The
query is designed to grab a name form a table(The name may be listed several
different times) and show a report of everything that related to that name.
However when the query is run it just has a blank report as if it doesn't
recgonize the name. I will post the SQL of the query but if there is
something else that I would need to post for help please let me know.

SELECT Users.UserName, CompleteList.DirectoryName
FROM Users INNER JOIN CompleteList ON Users.UsersID = CompleteList.UserName
WHERE (((Users.UserName)=[Forms]![PersonAccess]![cboSearch]));


--
John Goddard
Ottawa, ON Canada
jrgoddard at cyberus dot ca

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200910/1

  #4  
Old October 27th, 2009, 07:42 PM posted to microsoft.public.access.forms
J_Goddard via AccessMonster.com
external usenet poster
 
Posts: 221
Default Form that Runs a Query.

Hi -

Taking another look at your query - are you sure your join (Users.UsersID =
CompleteList.UserName)is using the correct fields? A UserID is usually
numeric, while a UserName is more likely to be a string, so perhaps your
query is not returning any values at all anyway. Did you try it out in the
query design grid?

HTH

John


Chris wrote:
I have set up a Form that has a combo box. When something in selected in the
combo box it automatically runs a query. The problem that I am having is
that I don't believe that the query is picking up the name correctly. The
query is designed to grab a name form a table(The name may be listed several
different times) and show a report of everything that related to that name.
However when the query is run it just has a blank report as if it doesn't
recgonize the name. I will post the SQL of the query but if there is
something else that I would need to post for help please let me know.

SELECT Users.UserName, CompleteList.DirectoryName
FROM Users INNER JOIN CompleteList ON Users.UsersID = CompleteList.UserName
WHERE (((Users.UserName)=[Forms]![PersonAccess]![cboSearch]));


--
John Goddard
Ottawa, ON Canada
jrgoddard at cyberus dot ca

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200910/1

  #5  
Old October 28th, 2009, 07:41 PM posted to microsoft.public.access.forms
chris
external usenet poster
 
Posts: 2,039
Default Form that Runs a Query.

Yea I believe that the query is working just fine. I origionally started out
where this query, when run, would prompt you for a name, I would enter the
name and all related information would show. I wanted to change this so that
instead of prompting for me to type a name I would just be able to select a
name. I was told that in order to do that I needed to create a form with a
combo box and have it relate back to the query. I did that and that is where
I am at now. However I am having the problem that I previously mentioned.

"J_Goddard via AccessMonster.com" wrote:

Hi -

Taking another look at your query - are you sure your join (Users.UsersID =
CompleteList.UserName)is using the correct fields? A UserID is usually
numeric, while a UserName is more likely to be a string, so perhaps your
query is not returning any values at all anyway. Did you try it out in the
query design grid?

HTH

John


Chris wrote:
I have set up a Form that has a combo box. When something in selected in the
combo box it automatically runs a query. The problem that I am having is
that I don't believe that the query is picking up the name correctly. The
query is designed to grab a name form a table(The name may be listed several
different times) and show a report of everything that related to that name.
However when the query is run it just has a blank report as if it doesn't
recgonize the name. I will post the SQL of the query but if there is
something else that I would need to post for help please let me know.

SELECT Users.UserName, CompleteList.DirectoryName
FROM Users INNER JOIN CompleteList ON Users.UsersID = CompleteList.UserName
WHERE (((Users.UserName)=[Forms]![PersonAccess]![cboSearch]));


--
John Goddard
Ottawa, ON Canada
jrgoddard at cyberus dot ca

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200910/1

.

  #6  
Old October 30th, 2009, 05:04 PM posted to microsoft.public.access.forms
J_Goddard via AccessMonster.com
external usenet poster
 
Posts: 221
Default Form that Runs a Query.

What is the code you are using to open the query from the form, after you
make the selection in your combo box?

John


Chris wrote:
Yea I believe that the query is working just fine. I origionally started out
where this query, when run, would prompt you for a name, I would enter the
name and all related information would show. I wanted to change this so that
instead of prompting for me to type a name I would just be able to select a
name. I was told that in order to do that I needed to create a form with a
combo box and have it relate back to the query. I did that and that is where
I am at now. However I am having the problem that I previously mentioned.

Hi -

[quoted text clipped - 20 lines]
FROM Users INNER JOIN CompleteList ON Users.UsersID = CompleteList.UserName
WHERE (((Users.UserName)=[Forms]![PersonAccess]![cboSearch]));


--
John Goddard
Ottawa, ON Canada
jrgoddard at cyberus dot ca

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200910/1

  #7  
Old November 3rd, 2009, 09:01 PM posted to microsoft.public.access.forms
chris
external usenet poster
 
Posts: 2,039
Default Form that Runs a Query.

Not sure what you are asking for or how to even show you what you might need
to know. Can you give me some direction on how to show you what you are
wanting to see?

"J_Goddard via AccessMonster.com" wrote:

What is the code you are using to open the query from the form, after you
make the selection in your combo box?

John


Chris wrote:
Yea I believe that the query is working just fine. I origionally started out
where this query, when run, would prompt you for a name, I would enter the
name and all related information would show. I wanted to change this so that
instead of prompting for me to type a name I would just be able to select a
name. I was told that in order to do that I needed to create a form with a
combo box and have it relate back to the query. I did that and that is where
I am at now. However I am having the problem that I previously mentioned.

Hi -

[quoted text clipped - 20 lines]
FROM Users INNER JOIN CompleteList ON Users.UsersID = CompleteList.UserName
WHERE (((Users.UserName)=[Forms]![PersonAccess]![cboSearch]));


--
John Goddard
Ottawa, ON Canada
jrgoddard at cyberus dot ca

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200910/1

.

  #8  
Old November 3rd, 2009, 09:06 PM posted to microsoft.public.access.forms
chris
external usenet poster
 
Posts: 2,039
Default Form that Runs a Query.

It won't run the query when I make this modification.

"NG" wrote:

You could try:

SELECT Users.UserName, CompleteList.DirectoryName
FROM Users INNER JOIN CompleteList ON Users.UsersID = CompleteList.UserName
WHERE Users.UserName = """ & [Forms]![PersonAccess]![cboSearch] & """"

kind regards
NG

"Chris" wrote:

I have set up a Form that has a combo box. When something in selected in the
combo box it automatically runs a query. The problem that I am having is
that I don't believe that the query is picking up the name correctly. The
query is designed to grab a name form a table(The name may be listed several
different times) and show a report of everything that related to that name.
However when the query is run it just has a blank report as if it doesn't
recgonize the name. I will post the SQL of the query but if there is
something else that I would need to post for help please let me know.

SELECT Users.UserName, CompleteList.DirectoryName
FROM Users INNER JOIN CompleteList ON Users.UsersID = CompleteList.UserName
WHERE (((Users.UserName)=[Forms]![PersonAccess]![cboSearch]));

  #9  
Old November 3rd, 2009, 09:08 PM posted to microsoft.public.access.forms
chris
external usenet poster
 
Posts: 2,039
Default Form that Runs a Query.

I think that this is what you were looking for. PLease let me know if you
have any idea on how it should be changed.

Option Compare Database

Private Sub cboSearch_Change()
DoCmd.OpenQuery "DirectoryAccess"
Me.cboSearch = ""

End Sub

Private Sub Detail_Click()

End Sub


"J_Goddard via AccessMonster.com" wrote:

What is the code you are using to open the query from the form, after you
make the selection in your combo box?

John


Chris wrote:
Yea I believe that the query is working just fine. I origionally started out
where this query, when run, would prompt you for a name, I would enter the
name and all related information would show. I wanted to change this so that
instead of prompting for me to type a name I would just be able to select a
name. I was told that in order to do that I needed to create a form with a
combo box and have it relate back to the query. I did that and that is where
I am at now. However I am having the problem that I previously mentioned.

Hi -

[quoted text clipped - 20 lines]
FROM Users INNER JOIN CompleteList ON Users.UsersID = CompleteList.UserName
WHERE (((Users.UserName)=[Forms]![PersonAccess]![cboSearch]));


--
John Goddard
Ottawa, ON Canada
jrgoddard at cyberus dot ca

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200910/1

.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:33 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.