[AccessD] A Question of Timing

Beach Access Software bchacc at san.rr.com
Thu Jan 4 13:15:17 CST 2007


Fortunately the language table is in the front end.  That's so each user can
select their own language.

Rocky 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Hale, Jim
Sent: Thursday, January 04, 2007 8:58 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] A Question of Timing

If you are going to use seek on back end tables you will need to set the
database variable using a function like WhichDB.
HTH 
Jim Hale

Function CurrYear() As Integer
Dim strTable As String, db As Database, rs As Recordset
'find current month in periods table
    strTable = "tblPeriods"
    Set db = WhichDB(strTable)
    Set rs = db.OpenRecordset(strTable, dbOpenTable)
    'find record with the current year
    rs.Index = "fldStatus"
    rs.Seek "=", "B"
    CurrYear = rs.Fields("fldYear")
   

Function WhichDB(strTableName As String) As Database
Dim dbpath$, SourceTable$, dbTest As Database

On Error GoTo whichDB_ERR
Set dbTest = DBEngine(0)(0)
dbpath = Mid(dbTest(strTableName).Connect, InStr(1,
dbTest(strTableName).Connect, "=") + 1)
If dbpath = "" Then
    Set dbTest = CurrentDb()
Else
    Set dbTest = DBEngine(0).OpenDatabase(dbpath)
End If
Set WhichDB = dbTest
whichDB_EXIT:

  Exit Function
  
whichDB_ERR:
  MsgBox Err.Description
  Resume whichDB_EXIT
End Function

-----Original Message-----
From: Gustav Brock [mailto:Gustav at cactus.dk]
Sent: Thursday, January 04, 2007 10:08 AM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] A Question of Timing


Hi Rocky

You could use DAO and the Seek method on this local table if it is indexed
properly.
Seek is extremely fast but the syntax is a bit weird.

/gustav


***********************************************************************
The information transmitted is intended solely for the individual or
entity to which it is addressed and may contain confidential and/or
privileged material. Any review, retransmission, dissemination or
other use of or taking action in reliance upon this information by
persons or entities other than the intended recipient is prohibited.
If you have received this email in error please contact the sender and
delete the material from any computer. As a recipient of this email,
you are responsible for screening its contents and the contents of any
attachments for the presence of viruses. No liability is accepted for
any damages caused by any virus transmitted by this email.
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.16.4/615 - Release Date: 1/3/2007
1:34 PM
 




More information about the AccessD mailing list