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 / Queries / July 2006

Tip: Looking for answers? Try searching our database.

Call Parameter Query from VB

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve Haack - 20 Jul 2006 14:06 GMT
I have a parameter query that gets user input, and then displays the query
result in a Form. The Query selects and combines data from multiple tables
onto the Form. This is a read only form, since it is not displaying the
actual fields from the data base.

If the user needs to change something, I have an "Edit This" command button
that opens the specific data element in a new form which is based on the
original table.

When the user makes a change and closes the "Edit This" form, the new data
is not reflected in the original query form. I know that the original form
needs to requery, but I am not sure how to do that without the user having to
enter the original parameter again.

How do I get that original form, to rerun the query without having the user
reenter the original parameter?

Thanks,
Steve
Michel Walsh - 20 Jul 2006 22:52 GMT
Hi,

To "filter" in addition to what is already initially restricted by a
criteria, use

Me.Filter = "FieldName=what"
Me.FilterOn = true

Is it what you want?

Hoping it may help
Vanderghast, Access MVP

>I have a parameter query that gets user input, and then displays the query
> result in a Form. The Query selects and combines data from multiple tables
[quoted text clipped - 18 lines]
> Thanks,
> Steve
Steve Haack - 24 Jul 2006 04:08 GMT
I don't think so. Let me try to explain it again.

I have a form that has its Source set to a query that asks the user to enter
criteria (lets just say a last name), and then displays data from several
tables.

For simplicity, I have placed some ccommand buttons on the form, so that if
the user wants to edit some of the data, it opens a new form with the
specific data in it so that it can be edited.

When the user closes the "editing" form, the original form is still open,
but is now displaying old data.

What I want to do, is have the original form re-query the data, but without
asking the user for the criteria again.

Does that make sense?

Steve

> Hi,
>
[quoted text clipped - 31 lines]
> > Thanks,
> > Steve
Michel Walsh - 25 Jul 2006 13:13 GMT
Hi,

If you don't need to see NEW records, just the existing one, but with their
modified values,

   Me.Refresh

won't ask for the parameters.

Hoping it may help,
Vanderghast, Access MVP

>I don't think so. Let me try to explain it again.
>
[quoted text clipped - 60 lines]
>> > Thanks,
>> > Steve
Steve Haack - 25 Jul 2006 19:15 GMT
I tried that, but it doesn't work. I think it is becasue the form is not
display data directly from the table, but from a query which is combining and
calculating the various fields, so the "refresh" doesn't work. ReQuery will,
but it prompts the user, so I was looking for a way to supply the parameter
that the user already supplied and do a ReQuery.

Steve

> Hi,
>
[quoted text clipped - 72 lines]
> >> > Thanks,
> >> > Steve
Michel Walsh - 26 Jul 2006 22:54 GMT
Hi,

If you have your hands on the value of the parameter, then:

Option Compare Database
Option Explicit
Dim qdf As QueryDef
Dim rst As DAO.Recordset

Private Sub Command2_Click()

       Set qdf = CurrentDb.QueryDefs("MyQuery")
       qdf.Parameters(0) = 2 '<---- the parameter
       Set rst = qdf.OpenRecordset(dbOpenDynaset)
       Set Me.Recordset = rst
End Sub

To get the values of the parameter(s), someone can include them in the
SELECT list:

SELECT f1, f2, f3, param1
FROM myTable
WHERE f5>= param1

and thus, they will be in the recordset of the form that has been open on
the said query.

Hoping it may help,
Vanderghast, Access MVP

>I tried that, but it doesn't work. I think it is becasue the form is not
> display data directly from the table, but from a query which is combining
[quoted text clipped - 91 lines]
>> >> > Thanks,
>> >> > Steve
Steve Haack - 27 Jul 2006 01:12 GMT
That's exactly what I was looking for.

Thanks a bunch.

Steve

> Hi,
>
[quoted text clipped - 121 lines]
> >> >> > Thanks,
> >> >> > Steve
 
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.