wind20mph
MS Access User Since 1996
- Local time
- Today, 08:53
- Joined
- Mar 5, 2013
- Messages
- 50
hi again everyone. i didn't post quite a long time. been doing great with ms access 2007. and moving on, i need help on reading text file, line by line and storing them into separate string variables...
i have this text file: "E:\Data\Access\connection.dll" and it contains 4 rows:
102.16.21.14
mntdb
mntuser
123456
which means, instead of editing the module connection string, i'll just edit the text file to use which server.
i tried the following code but it didn't worked:
i wanted to use it in a connection string function module. any help, assistance is highly appreciated.
i will be using this connection string in all of my modules. any help please....
i have this text file: "E:\Data\Access\connection.dll" and it contains 4 rows:
102.16.21.14
mntdb
mntuser
123456
which means, instead of editing the module connection string, i'll just edit the text file to use which server.
i tried the following code but it didn't worked:
Code:
Dim TextFile As Integer
Dim FilePath As String
Dim FileContent, strHost, strDB, strUser, strPassword As String
'File Path of Text File
FilePath = "E:\Data\Access\connection.dll"
'Determine the next file number available for use by the FileOpen function
TextFile = FreeFile
'Open the text file
Open FilePath For Input As TextFile
'Store file content inside a variable
FileContent = Input(LOF(TextFile), TextFile)
'Report Out Text File Contents
strHost FileContent
strDB FileContent
strUser FileContent
strPassword FileContent
'Close Text File
Close TextFile
i wanted to use it in a connection string function module. any help, assistance is highly appreciated.
Code:
Function conString() as String
conString = "Driver={MySQL ODBC 3.51 Driver};Server=" & strHost & "Port=3306; Database=" & strDB & ";User=" & strUser & ";Password=" & strPassword & ";Option=3;"
End Function
i will be using this connection string in all of my modules. any help please....