By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,476 Members | 889 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,476 IT Pros & Developers. It's quick & easy.

How to Read a Config File in Access

P: 24
Hello,

New to Access and I need to know how can I do this.

I need to read a Config file and use that in my Access Code.

I tried to look up in the MSDN for objects like Open, Read in Access but couldn't find anything about "Read"

For Ex:

Dim FilePath as string
FilePath = Access.CurrentDB.Name + "ConfigFile.txt"

Open FilePath FOR INPUT as #FilePath

Now I am not sure how can I read. I am struck with Syntax and couldn't find any relevant documentation.

Can some one answer this please.

Thanks,
YMK
Nov 27 '06 #1
Share this Question
Share on Google+
2 Replies


PEB
Expert 100+
P: 1,418
PEB
Hello,

New to Access and I need to know how can I do this.

I need to read a Config file and use that in my Access Code.

I tried to look up in the MSDN for objects like Open, Read in Access but couldn't find anything about "Read"

For Ex:

Dim FilePath as string
FilePath = Access.CurrentDB.Name + "ConfigFile.txt"

Open FilePath FOR INPUT as #FilePath

Now I am not sure how can I read. I am struck with Syntax and couldn't find any relevant documentation.

Can some one answer this please.

Thanks,
YMK
To get the lines from the file try:

Dim FilePath as string
FilePath = Access.CurrentDB.Name + "ConfigFile.txt"

Open FilePath FOR INPUT as #1
do while not eof(1)
Input #1, myline
process my line
loop
Close #1

but it depends on what kind of config file is yours... There is stored things about the ini files i think! Sure that there is something in VB but in Access never tried for the ini's

If your config.txt is plain usual text u can open the file and get the data using this algo..
Nov 27 '06 #2

P: 24
ymk
To get the lines from the file try:

Dim FilePath as string
FilePath = Access.CurrentDB.Name + "ConfigFile.txt"

Open FilePath FOR INPUT as #1
do while not eof(1)
Input #1, myline
process my line
loop
Close #1

but it depends on what kind of config file is yours... There is stored things about the ini files i think! Sure that there is something in VB but in Access never tried for the ini's

If your config.txt is plain usual text u can open the file and get the data using this algo..
Thank You. It worked.
Nov 27 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.