Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2004

    Unhappy Unanswered: VB to MS Access?

    I need help and assistance. A newbie with VB here.

    I have a software note statistic with all the data saved in a logfile (notestatistic.txt).
    These are real time data. Take a look at it.

    I want to create a VB program that can read and write or store all the data into it.

    These data will then be put inside MS Access database into all their relevant fields.
    The fields inside the Database are:-

    User_ID (Primary Key & Auto Number)

    Anyone got any idea how I can do this? From the Notepad logfile, create a program that can transfer these data into the VB, then from the VB, create some code to transfer these data into the database.
    Attached Files Attached Files

  2. #2
    Join Date
    Dec 2004
    Laguna, Philippines
    Use "FileSystemObject" in transferring data from textfile to vb and then use "Adodb" in transferring data from vb to database.
    Give me a place to code and i shall move the earth!

  3. #3
    Join Date
    Jun 2004
    I've made some modification.
    Can u try to complete my SQL insert statement? And also take a look at my codes and highlight some unnecessary stuffs or if there's any errors. Attach is the database and textfile which has been zipped.

    Private Sub Command1_Click()

    Dim intFNum As Integer
    Dim intMsg As Integer
    Dim TempCounter As Integer
    Dim DataStored(2000) As String

    intFNum = FreeFile

    Open "C:\NoteStatistics.txt" For Input As #intFNum

    ' Open database connection
    Dim MyConn As ADODB.Connection
    Set MyConn = New ADODB.Connection
    MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\testing.mdb;"

    ' Read lines one at a time until the end of file.
    Do While Not EOF(intFNum)
    Input #intFNum, DataStored(TempCounter) ' Store data in an array
    MyConn.Execute ("INSERT INTO Users(Mac_Address, Signal_Strength, Throughput, Packet_Retry, Time, SSID) VALUES ()")
    TempCounter = TempCounter + 1 ' Increment the counter

    Close #intFNum

    End Sub
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts