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  

Perfimace a query after entry data in a form



 
 
Thread Tools Display Modes
  #1  
Old November 3rd, 2005, 04:48 PM
Felipe
external usenet poster
 
Posts: n/a
Default Perfimace a query after entry data in a form

How to performance several queries in a predetermined order at a form?
I have some queries that calculate values that I use I other queries to
calculate other values. I want to after I place all the data of a new record
the form performance all the queries in the right order. Pretty much all that
I can do how is add several buttons to run each form.

  #2  
Old November 3rd, 2005, 06:02 PM
Klatuu
external usenet poster
 
Posts: n/a
Default Perfimace a query after entry data in a form

You can put code in the After Update event of the form where you enter the
data to perform whatever tasks you need to do in the order you want them.

"Felipe" wrote:

How to performance several queries in a predetermined order at a form?
I have some queries that calculate values that I use I other queries to
calculate other values. I want to after I place all the data of a new record
the form performance all the queries in the right order. Pretty much all that
I can do how is add several buttons to run each form.

  #3  
Old November 3rd, 2005, 06:05 PM
John Vinson
external usenet poster
 
Posts: n/a
Default Perfimace a query after entry data in a form

On Thu, 3 Nov 2005 08:48:05 -0800, Felipe
wrote:

How to performance several queries in a predetermined order at a form?
I have some queries that calculate values that I use I other queries to
calculate other values. I want to after I place all the data of a new record
the form performance all the queries in the right order. Pretty much all that
I can do how is add several buttons to run each form.


This seems like a very odd way to do things.

It is almost NEVER necessary to run even one action query in order to
do calculations. Running several is even less common.

To directly answer the questions, you can create a Macro or (better) a
VBA subroutine to execute action queries (using the RunQuery action in
a macro, or the querydef Execute method in VBA).

However, I very strongly suspect there are better ways to accomplish
what you want to do! Could you explain what these queries are doing?

John W. Vinson[MVP]
  #4  
Old November 3rd, 2005, 07:05 PM
Felipe
external usenet poster
 
Posts: n/a
Default Perfimace a query after entry data in a form

I work in the construction business and I’m taking spreadsheet and turning in
a access data base. I keep loosing info so I decide to put all together in a
data base, I build 12 table linked together by an id number and made more 12
queries do to do all de calculation I need. I use the type of query that adds
line to a table so I can keep in my data base all the results and also make
easier to access to make calculus that is base in other previews calculated
values. And every thing is linked to an id number, so I have to do run the
queries in the right order.
All the calculus are working fine but I need something to make all then run
in the right time and after that open an report or an other form.
thanks for the atencion
"John Vinson" escreveu:

On Thu, 3 Nov 2005 08:48:05 -0800, Felipe
wrote:

How to performance several queries in a predetermined order at a form?
I have some queries that calculate values that I use I other queries to
calculate other values. I want to after I place all the data of a new record
the form performance all the queries in the right order. Pretty much all that
I can do how is add several buttons to run each form.


This seems like a very odd way to do things.

It is almost NEVER necessary to run even one action query in order to
do calculations. Running several is even less common.

To directly answer the questions, you can create a Macro or (better) a
VBA subroutine to execute action queries (using the RunQuery action in
a macro, or the querydef Execute method in VBA).

However, I very strongly suspect there are better ways to accomplish
what you want to do! Could you explain what these queries are doing?

John W. Vinson[MVP]

  #5  
Old November 3rd, 2005, 09:55 PM
John Vinson
external usenet poster
 
Posts: n/a
Default Perfimace a query after entry data in a form

On Thu, 3 Nov 2005 11:05:06 -0800, Felipe
wrote:

I work in the construction business and I’m taking spreadsheet and turning in
a access data base. I keep loosing info so I decide to put all together in a
data base, I build 12 table linked together by an id number and made more 12
queries do to do all de calculation I need. I use the type of query that adds
line to a table so I can keep in my data base all the results and also make
easier to access to make calculus that is base in other previews calculated
values. And every thing is linked to an id number, so I have to do run the
queries in the right order.
All the calculus are working fine but I need something to make all then run
in the right time and after that open an report or an other form.


You may want to consider doing the calculations in Excel (Excel is
very good at that g) and importing the resulting spreadsheet page
into Access; but if what you're doing is working, simply run the
queries from VBA code, perhaps in the Click event of a command button.
If there are that meny queries, I'd suggest setting up a small table
named CalcQueries with one text field QueryName containing the name of
each query, and a numeric field Seq containing a number specifying the
order in which the queries should be run. You could then run code
like:

Private Sub cmdRunQueries_Click()
Dim db As DAO.Database
Dim qd As DAO.Querydef
Dim rs As DAO.Recordset
Dim strSQL As String
On Error GoTo Proc_Error
Set db = CurrentDb
strSQL = "SELECT QueryName FROM CalcQueries ORDER BY Seq;"
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
rs.MoveFirst
Do Until rs.EOF
Set qd = db.Querydefs(rs!QueryName) ' get the query name to execute
qd.Execute, dbFailOnError
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
Proc_Exit: Exit Sub
Proc_Error:
MsgBox "Error " & Err.Number & " in cmdRunQueries_Click:" _
& vbCrLf & Err.Description
Resume Proc_Exit
End Sub


John W. Vinson[MVP]



  #6  
Old November 7th, 2005, 07:07 PM
Felipe
external usenet poster
 
Posts: n/a
Default Perfimace a query after entry data in a form

It didn't work after all, I tried to make a module with the stament you gave
me and then I make a macro that run is. I guess what you told me wolud work
for sure but I just don't how to set it up

"John Vinson" escreveu:

On Thu, 3 Nov 2005 11:05:06 -0800, Felipe
wrote:

I work in the construction business and I’m taking spreadsheet and turning in
a access data base. I keep loosing info so I decide to put all together in a
data base, I build 12 table linked together by an id number and made more 12
queries do to do all de calculation I need. I use the type of query that adds
line to a table so I can keep in my data base all the results and also make
easier to access to make calculus that is base in other previews calculated
values. And every thing is linked to an id number, so I have to do run the
queries in the right order.
All the calculus are working fine but I need something to make all then run
in the right time and after that open an report or an other form.


You may want to consider doing the calculations in Excel (Excel is
very good at that g) and importing the resulting spreadsheet page
into Access; but if what you're doing is working, simply run the
queries from VBA code, perhaps in the Click event of a command button.
If there are that meny queries, I'd suggest setting up a small table
named CalcQueries with one text field QueryName containing the name of
each query, and a numeric field Seq containing a number specifying the
order in which the queries should be run. You could then run code
like:

Private Sub cmdRunQueries_Click()
Dim db As DAO.Database
Dim qd As DAO.Querydef
Dim rs As DAO.Recordset
Dim strSQL As String
On Error GoTo Proc_Error
Set db = CurrentDb
strSQL = "SELECT QueryName FROM CalcQueries ORDER BY Seq;"
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
rs.MoveFirst
Do Until rs.EOF
Set qd = db.Querydefs(rs!QueryName) ' get the query name to execute
qd.Execute, dbFailOnError
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
Proc_Exit: Exit Sub
Proc_Error:
MsgBox "Error " & Err.Number & " in cmdRunQueries_Click:" _
& vbCrLf & Err.Description
Resume Proc_Exit
End Sub


John W. Vinson[MVP]




 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
PST file has reached maximum size Jeff C General Discussion 2 October 6th, 2005 01:35 PM
Union Query Not Returning A Value Jeff G Running & Setting Up Queries 2 October 19th, 2004 05:47 PM
Filtering records in a form based on data in a subform or query. jbuck Using Forms 0 August 5th, 2004 02:51 PM
Display Parameter from Form on Report sara Setting Up & Running Reports 10 July 19th, 2004 04:54 PM
Newbie? Do I use Report or Query John Egan New Users 11 June 28th, 2004 08:31 PM


All times are GMT +1. The time now is 08:34 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.