PC Review


Reply
Thread Tools Rate Thread

Passing paramater in VBA

 
 
J. Shrimps Jr.
Guest
Posts: n/a
 
      1st Feb 2004
This function will re-link all tables from a single
external database:

Function LinkAllTables(sDbName As String)
Dim db As Database, tdf As TableDef
Set db = DBEngine.OpenDatabase(sDbName)
For Each tdf In db.TableDefs
If (tdf.Attributes And dbSystemObject) = 0 Then
AttachTable tdf.Name, sDbName
End If
Next
db.Close
End Function

Now, I would like to re-link all tables in several
databases (.mde's actually).
All databases are in the same directory,
but this code passes the string ' & strFileName &'
to the LinkAllTables function,
NOT the name of the actual MDE in the directory.
LinkAllTables function should
link all mde's found in the directory.

What combination of &/'/" do I need to pass the name of
strFileName to LinkAllTables as found in line 4 below?

Dim strFileName As String
strFileName = Dir("v:\inventory\Building*.mde")
Do While strFileName <> ""
LinkAllTables (" & strFileName & ") 'pass strFileName
'to function
strFileName = Dir()
Loop


 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      1st Feb 2004
Already answered in another newsgroup to which you posted the same question.

If you feel you need to post to more than one group (HINT: it's seldom
necessary), please have the courtesy to cross-post (send the one message to
all groups at once), rather than multi-post (send individual messages to
each group). In this way, all responses to your post will be available
together, regardless of what group the responder was in, and the rest of us
won't have to read your post multiple times. (It also uses fewer server
resources)

If you're using Microsoft's web interface to post, please note that you can
type the names of the various groups into the Newsgroup box. Separate each
newsgroup name with a semicolon.

Note that it's generally consider to be A Bad Thing to cross-post to more
than about 2 or 3 newsgroups. (In fact, at
http://www.microsoft.com/presspass/f.../Mar27pmvp.asp
Microsoft suggests that "One group will suffice")



--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)



"J. Shrimps Jr." <(E-Mail Removed)> wrote in message
news:83e401c3e8cf$0675e5d0$(E-Mail Removed)...
> This function will re-link all tables from a single
> external database:
>
> Function LinkAllTables(sDbName As String)
> Dim db As Database, tdf As TableDef
> Set db = DBEngine.OpenDatabase(sDbName)
> For Each tdf In db.TableDefs
> If (tdf.Attributes And dbSystemObject) = 0 Then
> AttachTable tdf.Name, sDbName
> End If
> Next
> db.Close
> End Function
>
> Now, I would like to re-link all tables in several
> databases (.mde's actually).
> All databases are in the same directory,
> but this code passes the string ' & strFileName &'
> to the LinkAllTables function,
> NOT the name of the actual MDE in the directory.
> LinkAllTables function should
> link all mde's found in the directory.
>
> What combination of &/'/" do I need to pass the name of
> strFileName to LinkAllTables as found in line 4 below?
>
> Dim strFileName As String
> strFileName = Dir("v:\inventory\Building*.mde")
> Do While strFileName <> ""
> LinkAllTables (" & strFileName & ") 'pass strFileName
> 'to function
> strFileName = Dir()
> Loop
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing Paramater to Javascript Function =?Utf-8?B?bm9iYWc=?= Microsoft Frontpage 3 13th Mar 2006 12:51 PM
Q: passing a date paramater =?Utf-8?B?SklNLkgu?= Microsoft ASP .NET 1 23rd Dec 2004 05:52 PM
Passing Paramater =?Utf-8?B?YnJpYW4=?= Microsoft Access VBA Modules 1 20th Oct 2003 07:35 PM
Re: Passing Paramater to form John Spencer (MVP) Microsoft Access VBA Modules 0 1st Sep 2003 03:45 PM
Re: Passing Paramater to form HSalim Microsoft Access VBA Modules 0 29th Aug 2003 08:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:28 PM.