473,395 Members | 1,383 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

This works, yes - but why?

In the FE mdb I put two variables in a module:

Private selectedFromDate As Date
Private selectedToDate As Date

I create functions/subs:

Public Sub SetSelectedFromDate(fromDate As Date)
selectedFromDate = fromDate
End Sub

Public Sub SetSelectedToDate(toDate As Date)
selectedToDate = toDate
End Sub

Public Function GetSelectedFromDate() As Date
GetSelectedFromDate = selectedFromDate
End Function

Public Function GetSelectedToDate() As Date
GetSelectedToDate = selectedToDate
End Function

---------------------------------------------

In the BE mdb, I have a stored query:

SELECT off_name, cs_open_date
FROM offender INNER JOIN current_sup
ON offender.offender_id = current_sup.cs_off_id
WHERE current_sup.cs_open_date
Between GetSelectedFromDate() And GetSelectedToDate()
The mdb files are not linked; I simply use this to get the data:

Private Sub Report_Open(Cancel As Integer)
Me.RecordSource = "SELECT * FROM OpeningsbyDateRangeQuery IN ' " &
GetBackendPath() & " ' "
End Sub

So, how does this work? Does the CurrentProject.Connection cover any mdb
that it touches? How does the BE mdb know what the two functions are, since
they are only defined (and given value) in the FE?
Darryl Kerkeslager



Nov 13 '05 #1
9 1289
Explain how the FE and BE are not linked. Access can only deal with data
tables that are local/imported OR that are linked to at some known location.
-Ed

"Darryl Kerkeslager" <Ke*********@comcast.net> wrote in message
news:a5********************@comcast.com...
In the FE mdb I put two variables in a module:

Private selectedFromDate As Date
Private selectedToDate As Date

I create functions/subs:

Public Sub SetSelectedFromDate(fromDate As Date)
selectedFromDate = fromDate
End Sub

Public Sub SetSelectedToDate(toDate As Date)
selectedToDate = toDate
End Sub

Public Function GetSelectedFromDate() As Date
GetSelectedFromDate = selectedFromDate
End Function

Public Function GetSelectedToDate() As Date
GetSelectedToDate = selectedToDate
End Function

---------------------------------------------

In the BE mdb, I have a stored query:

SELECT off_name, cs_open_date
FROM offender INNER JOIN current_sup
ON offender.offender_id = current_sup.cs_off_id
WHERE current_sup.cs_open_date
Between GetSelectedFromDate() And GetSelectedToDate()
The mdb files are not linked; I simply use this to get the data:

Private Sub Report_Open(Cancel As Integer)
Me.RecordSource = "SELECT * FROM OpeningsbyDateRangeQuery IN ' " &
GetBackendPath() & " ' "
End Sub

So, how does this work? Does the CurrentProject.Connection cover any mdb
that it touches? How does the BE mdb know what the two functions are,
since
they are only defined (and given value) in the FE?
Darryl Kerkeslager



Nov 13 '05 #2
Ed Robichaud wrote:
Explain how the FE and BE are not linked. Access can only deal with
data tables that are local/imported OR that are linked to at some
known location. -Ed
Incorrect. If you look at his code again it is specifying the path to an
external file as part of the SQL. In that case no link is required.
"Darryl Kerkeslager" <Ke*********@comcast.net> wrote in message
news:a5********************@comcast.com...
In the FE mdb I put two variables in a module:

Private selectedFromDate As Date
Private selectedToDate As Date

I create functions/subs:

Public Sub SetSelectedFromDate(fromDate As Date)
selectedFromDate = fromDate
End Sub

Public Sub SetSelectedToDate(toDate As Date)
selectedToDate = toDate
End Sub

Public Function GetSelectedFromDate() As Date
GetSelectedFromDate = selectedFromDate
End Function

Public Function GetSelectedToDate() As Date
GetSelectedToDate = selectedToDate
End Function

---------------------------------------------

In the BE mdb, I have a stored query:

SELECT off_name, cs_open_date
FROM offender INNER JOIN current_sup
ON offender.offender_id = current_sup.cs_off_id
WHERE current_sup.cs_open_date
Between GetSelectedFromDate() And GetSelectedToDate()
The mdb files are not linked; I simply use this to get the data:

Private Sub Report_Open(Cancel As Integer)
Me.RecordSource = "SELECT * FROM OpeningsbyDateRangeQuery IN ' " &
GetBackendPath() & " ' "
End Sub

So, how does this work? Does the CurrentProject.Connection cover
any mdb that it touches? How does the BE mdb know what the two
functions are, since
they are only defined (and given value) in the FE?
Darryl Kerkeslager


Nov 13 '05 #3
On Tue, 11 Jan 2005 08:43:50 -0500, "Darryl Kerkeslager"
<Ke*********@comcast.net> wrote:
In the FE mdb I put two variables in a module:

Private selectedFromDate As Date
Private selectedToDate As Date

I create functions/subs:

Public Sub SetSelectedFromDate(fromDate As Date)
selectedFromDate = fromDate
End Sub

Public Sub SetSelectedToDate(toDate As Date)
selectedToDate = toDate
End Sub

Public Function GetSelectedFromDate() As Date
GetSelectedFromDate = selectedFromDate
End Function

Public Function GetSelectedToDate() As Date
GetSelectedToDate = selectedToDate
End Function

---------------------------------------------

In the BE mdb, I have a stored query:

SELECT off_name, cs_open_date
FROM offender INNER JOIN current_sup
ON offender.offender_id = current_sup.cs_off_id
WHERE current_sup.cs_open_date
Between GetSelectedFromDate() And GetSelectedToDate()
The mdb files are not linked; I simply use this to get the data:

Private Sub Report_Open(Cancel As Integer)
Me.RecordSource = "SELECT * FROM OpeningsbyDateRangeQuery IN ' " &
GetBackendPath() & " ' "
End Sub

So, how does this work? Does the CurrentProject.Connection cover any mdb
that it touches? How does the BE mdb know what the two functions are, since
they are only defined (and given value) in the FE?
Darryl Kerkeslager

Hi
Surely code is only ever run in the FE. If the functions were in the
BE database you could run the query there but not from the FE
database.
A stored query is not a stored procedure.
David

Nov 13 '05 #4
"David Schofield" <d.***************@blueyonder.co.uk> wrote
Surely code is only ever run in the FE. If the functions were in the
BE database you could run the query there but not from the FE
database.
A stored query is not a stored procedure.
David


Yes, actually I do run some code from the BE, on Saturday, when nobody else
is around ... I copy the three mdb files from the separate LANs, back up
the mdbs, delete the accumulated error log entries (sometimes I even find
the cause of the errors), run some code to find bad data entry and combine
new data from the three mdb files, and compact & repair. Then I send the mdb
carelessly back over the WAN to the remote sites. Hey, that's what backups
are for. While I *could* have a separate db to use as a FE just for my
Saturday dba functions, it is so much easier to just open each of the BE db,
do my work directly, and send thenm off.

The two functions in my original post are not stored in the BE, just
included in a saved/stored query (Access mdb stored query, not SQL Server
stored procedure). If I were to try to view the results of the query
directly from the BE, it errors with "undefined function". It only works
when the FE accesses the BE query - and then, "magically", the BE not only
knows about the function, but returns the result (from the FE) to the BE
stored query, which uses it to select the appropriate rows.

So how does it work?
Darryl Kerkeslager
Nov 13 '05 #5
On Tue, 11 Jan 2005 08:43:50 -0500, "Darryl Kerkeslager"
<Ke*********@comcast.net> wrote:
In the FE mdb I put two variables in a module:

Private selectedFromDate As Date
Private selectedToDate As Date

I create functions/subs:

Public Sub SetSelectedFromDate(fromDate As Date)
selectedFromDate = fromDate
End Sub

Public Sub SetSelectedToDate(toDate As Date)
selectedToDate = toDate
End Sub

Public Function GetSelectedFromDate() As Date
GetSelectedFromDate = selectedFromDate
End Function

Public Function GetSelectedToDate() As Date
GetSelectedToDate = selectedToDate
End Function

---------------------------------------------

In the BE mdb, I have a stored query:

SELECT off_name, cs_open_date
FROM offender INNER JOIN current_sup
ON offender.offender_id = current_sup.cs_off_id
WHERE current_sup.cs_open_date
Between GetSelectedFromDate() And GetSelectedToDate()
The mdb files are not linked; I simply use this to get the data:

Private Sub Report_Open(Cancel As Integer)
Me.RecordSource = "SELECT * FROM OpeningsbyDateRangeQuery IN ' " &
GetBackendPath() & " ' "
End Sub

So, how does this work? Does the CurrentProject.Connection cover any mdb
that it touches? How does the BE mdb know what the two functions are, since
they are only defined (and given value) in the FE?
Darryl Kerkeslager

Hi
Presumably the FE retrieves the (compiled) query from the BE and
executes it. If any of the function arguments depend on a field in the
base table, the whole table would have to be passed to the FE for
processing.
In the case of ODBCconnections you can see this sort of thing by
running with SQL tracing on.
I am actually replying to your response lower down but this hasn't
arrived at Newscene yet.
David
Nov 13 '05 #6
"David Schofield" <d.***************@blueyonder.co.uk> wrote
Presumably the FE retrieves the (compiled) query from the BE and
executes it.


so based on this, if the same query is placed in the FE, the code should
execute faster, because the step of retrieving the query is eliminated.
Darryl Kerkeslager
Nov 13 '05 #7
On Wed, 12 Jan 2005 21:06:28 -0500, "Darryl Kerkeslager"
<Ke*********@comcast.net> wrote:
"David Schofield" <d.***************@blueyonder.co.uk> wrote
Presumably the FE retrieves the (compiled) query from the BE and
executes it.


so based on this, if the same query is placed in the FE, the code should
execute faster, because the step of retrieving the query is eliminated.
Darryl Kerkeslager

Yes, but maybe this only applies if user functions are involved.

I have never used Access user functions in a query on a non-JET
backend and didn't even realise you could (if indeed you can, I am at
presently home and can't test it). However it shows why views/pass
though queries or stored procedures, which operate on the server, are
faster - especially if a function has to be evaluated on a per-record
basis.
David
Nov 13 '05 #8
"David Schofield" <d.***************@blueyonder.co.uk> wrote
Yes, but maybe this only applies if user functions are involved.

I have never used Access user functions in a query on a non-JET
backend and didn't even realise you could (if indeed you can, I am at
presently home and can't test it). However it shows why views/pass
though queries or stored procedures, which operate on the server, are
faster - especially if a function has to be evaluated on a per-record
basis.


I *am* using a Jet BE mdb file. The setup I described in the OP operates
in as close to zero time as one would expect. The only difference I did
notice when I timed it was that the query ran slower the first time - so I
assume that (somewhere) the query was optimized the first time, and operated
at optimized speed for additional calls. I am 99.854% certain that the
query is only returning the needed records to the FE.
Darryl Kerkeslager
Nov 13 '05 #9
On Thu, 13 Jan 2005 17:07:53 -0500, "Darryl Kerkeslager"
<Ke*********@comcast.net> wrote:
"David Schofield" <d.***************@blueyonder.co.uk> wrote
Yes, but maybe this only applies if user functions are involved.

I have never used Access user functions in a query on a non-JET
backend and didn't even realise you could (if indeed you can, I am at
presently home and can't test it). However it shows why views/pass
though queries or stored procedures, which operate on the server, are
faster - especially if a function has to be evaluated on a per-record
basis.


I *am* using a Jet BE mdb file. The setup I described in the OP operates
in as close to zero time as one would expect. The only difference I did
notice when I timed it was that the query ran slower the first time - so I
assume that (somewhere) the query was optimized the first time, and operated
at optimized speed for additional calls. I am 99.854% certain that the
query is only returning the needed records to the FE.
Darryl Kerkeslager

Hi
my reply to this seems to have vanished, anyway here is a fuller
version

Your criterion functions do not depend on the values of individual
records and so only need to be evaluated once. The time this takes and
the time for transmitting the query and these values between FE and BE
are negligible and in this case only the selected records will be sent
to the FE.

If your criterion function had an argument which depends on the value
of each record, I believe the whole set of records would be sent to
the FE and the selection done there. After all, the only other way
this could be done would be to send the function in some way from the
FE to the BE. But I think the back end is actually only invoking JET
and cannot understand code at all,

I mentioned other back ends only as an aside. If you do use an
ODBC-connected backend and switch on TRACE you can study how the query
optimiser allocates work between FE and BE However in these cases if
you need a function you would try to use a passthrough query with a
BE native SQL function or a stored procedure and not an Access
function.

David

Nov 13 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Randy Weber | last post by:
I have a page with two frames, 'header' and 'main'. The following code works in Netscape, but in Internet Explorer. The second bgColor line produces an error: function test(){...
2
by: deko | last post by:
Has anyone been able to import data from Claris Works into Access 2002? Is it simply a matter of exporting the Claris Works data into a comma delimited file and mapping the fields? Thanks in...
1
by: | last post by:
I got about half way through a project using Access from Microsoft Office when they decided they wanted to use Works instead. I looked at the db in works and it looks woefully inadequate. I could...
4
by: craigkenisston | last post by:
Looking for Internet Componets : anything comparable to IP Works? Hi, I need a suite of components that provided me with SMPT, POP3, NNTP, Telnet and Ping protocols. I have been looking and...
2
by: Enrique Bustamante | last post by:
Casting arrays that works on watch and command window but not in code. My application is casting arrays in a way it should work. To test if I was doing something invalid, I wrote a test code that...
1
by: chris huff via .NET 247 | last post by:
I have a primary user who does NOT have ms Excel. He runs MSWorks and uses the spreadsheet program within it. My vb.net application is focused around a price sheet that theuser updates via their...
1
by: Samuel | last post by:
Why my Crystal Report form works on the machine I installed VB.NET, not works on the machine without VB.NET? Thanks.
1
by: thubba2000 | last post by:
We have a web application developed using IBuySpy. In older versions, Autocomplete on all web forms works. In our latest version, it stopped working on all clients. I have gone through all the...
28
by: entfred | last post by:
I have the following line of html: &nbsp;&nbsp1234&nbsp;&nbsp;&nbsp;&nbsp;&nbspabc&nbsp;&nbsp;&nbspyow In Internet Explorer 6.0, the columns look ok using the above html: 1234 abcd ...
6
by: dthompson | last post by:
I have written a service designed to run on 2003 Servers, in development it works 100% on my Windows XP system. Once deployed to 2003 I keep getting the same error (File Not Found, error 53)...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.