Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / February 2006

Tip: Looking for answers? Try searching our database.

Displaying Query Results on a Form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Angeline - 01 Feb 2006 11:16 GMT
Hello,
Can someone please help me. I would like to display query results on a form.
I have built a database (most of which without VB but using the functions and
a little help here and there from you wonderful people), and have a form with
in it which consists of buttons that point to queries. I would like the query
results to look 'prettier' and tried linking the button to a 'report' which
displays the query results but I thought it would be much better to display
the results on a form so that it can have the same appearance.
Quick note: I don't know VB so might need a little bit of 'spoon feeding'.
Thanks!!
Jeff Boyce - 01 Feb 2006 13:22 GMT
Angeline

For one of your queries, use the forms wizard to help you build a form,
based on that query.

In your "button" form (by the way, there are other approaches than adding
one button per query), in one of the button's Click event, create an event
procedure something like:

   DoCmd.OpenForm "YourNewFormName"

Substitute the name of the new form you built (see above).  You may need to
check Access HELP for help with the syntax, or with Event Procedures.

Signature

Regards

Jeff Boyce
<Office/Access MVP>

> Hello,
> Can someone please help me. I would like to display query results on a form.
[quoted text clipped - 6 lines]
> Quick note: I don't know VB so might need a little bit of 'spoon feeding'.
> Thanks!!
Angeline - 02 Feb 2006 00:25 GMT
HI Jeff,
Thanks for your post (apologies for delay, I'm from Syd AUS)
I will try your suggestion (thankyou) can I ask them if it is possible to
display the results of more than one query on the one form.

Thanks again.

> Angeline
>
[quoted text clipped - 26 lines]
> > Quick note: I don't know VB so might need a little bit of 'spoon feeding'.
> > Thanks!!
Angeline - 02 Feb 2006 00:36 GMT
Hi again,
I did as you said and it worked except it only returned one of the results.
I'll explain. This is an 'exit interview' database which captures information
about why employees resign from their employer. This query calculates the
'top reason for leaving' the organisation and is based on an aggregate of all
the responses. The query results return like this:

The two column headers are : Top Reason for Leaving, Percentage
The results are: Pay & Benefits 19%
Learning & Development 21%
Career Opportunities 18%  etc

So the query resturns more than 1 value.

> Angeline
>
[quoted text clipped - 26 lines]
> > Quick note: I don't know VB so might need a little bit of 'spoon feeding'.
> > Thanks!!
Jeff Boyce - 02 Feb 2006 02:26 GMT
Angeline

Maybe we need to go back to the beginning.  You have queries that you want
to run ... against data.  How you query depends on how your data is
structured.  Could you describe how your data tables are designed?

Signature

More info, please ...

Jeff Boyce
<Office/Access MVP>

> Hi again,
> I did as you said and it worked except it only returned one of the results.
[quoted text clipped - 40 lines]
> > > Quick note: I don't know VB so might need a little bit of 'spoon feeding'.
> > > Thanks!!
Angeline - 02 Feb 2006 06:21 GMT
HI Jeff,
The main data table is populated from a form. I'm not sure what you mean by
'how is it designed'. I designed the main table in 'design view'. Then I
built a form with several tab to make it easy for a user to populate the main
table. I have built many queries to calculate 'statistical' results. These
are all working perfectly. Many of them however are queries built of queries.

I have set up a second form which is a panel of labelled buttons that
calculate various statistics (based on queries). I was hoping that, instead
of the results displaying in the raw query view - I could have them display
in a form. I can put them in a 'report' for the purposes of looking
'prettier' but from an end user perspective, it would be nicer on a form.

Thanks for your time Jeff
rgs

> Angeline
>
[quoted text clipped - 56 lines]
> feeding'.
> > > > Thanks!!
Jeff Boyce - 02 Feb 2006 13:14 GMT
Angeline

Sorry, inexact request on my part...

Please describe your data structure (what fields do you have in which
tables?)  I'm trying to get a sense of the data elements you are working
with.

Signature

Regards

Jeff Boyce
<Office/Access MVP>

> HI Jeff,
> The main data table is populated from a form. I'm not sure what you mean by
[quoted text clipped - 72 lines]
> > feeding'.
> > > > > Thanks!!
Rajat - 01 Feb 2006 13:46 GMT
well u can execute the query from VB & return the result to
recordset......& display the values frm the recordset on the form

sample:
dim db As Database
dim rs As Recordset
dim strSQL As String
Set db = OpenDatabase(database_name, False, True, "M
Access;PWD=passowrd,if any")
strSQL = "Select * from table_name"   ' this is sql statement ur gonn
execute
Set rs = db.OpenRecordset(strSQL) 'will execute sql statement & retur
result to recordset

now u can access result from the record set....
eg.
msgbox rs.field(0) ' 1st field in recordset

hope this helped...

--
Raja
Angeline - 02 Feb 2006 00:41 GMT
Raj,
The query is based on a query that is based on a query and I did not use VB
to write it, I used the front end. I think this might render your suggestion
a little too complicated for my novice mind. I wouldn't know where to start
wrting the code you specified and no, I don't have a password. In any case,
how would I learn VB?

Thank you very much though for your time.\

best regards,

> well u can execute the query from VB & return the result to a
> recordset......& display the values frm the recordset on the form
[quoted text clipped - 15 lines]
>
> hope this helped....
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.