Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397

    Unanswered: VBA code to Read/Write/Update data in Server Table

    I have installed Server 2000 Desktop Edition on my pc.

    And successfully deployed the tables of db onto the server. Then I connected those table into my MDB.

    Now previously when tables were localy kept, I was using the following code line to read, edit or save the data successfully. This code was written in AfterUpdate event of one of the unbound text box.

    Since I upsized my db tables to the sql server, this code does'nt work.

    Can some body tell me what code line would replace to the following ?

    Private Sub RolNo_AfterUpdate()
    On Error GoTo ErrTrap

    Dim db As DAO.Database
    Dim rst As DAO.Recordset
    Dim fld As DAO.Field

    ' 'Readnig data from table onto form
    Set rst = CurrentDb.OpenRecordset("select * From T_RollMaster Where RolNo= '" & Replace(RolNo, Chr(39), Chr(34) & Chr(34)) & "'")

    For Each fld In rst.Fields
    Me(fld.Name) = rst(fld.Name)
    Next fld

    rst.Close
    Set rst = Nothing

    ExitErrTrap:
    Exit Sub

    ErrTrap:
    If Err.Number = 2113 Then
    End If
    'MsgBox Err.Description & " " & Err.Number
    Resume ExitErrTrap

    End Sub

    Please advice what will be the Update and Add New Record code to in a server based table ?

    I am very new to Server(BE) and Access MDB (FE) method.

    With kind regard,
    Ashfaque

  2. #2
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,424
    Provided Answers: 8
    lets work out where the problem is

    1... can open the link table in the Database by Double clicking on the table
    2... can you add a record mananly

    make shore the link table are not pointing locally


    have we got a DAO connection

    delete the DAO.recordset
    retype it when you do the DAO.???????? <=??? do you get the List of thing you can add.
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

  3. #3
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397
    1... can open the link table in the Database by Double clicking on the table
    Yes..
    2... can you add a record mananly
    Yes...

    make shore the link table are not pointing locally

    Yes...

    have we got a DAO connection?

    Tbl names are simply as they were. Only thing that the are linked with server (Green ball symbol appeared prior to each table name. No "dao" tag appeared before any table name.

    have we got a DAO connection

    delete the DAO.recordset
    retype it when you do the DAO.???????? <=??? do you get the List of thing you can add.

    ? Not understand

    Ashfaque

Posting Permissions

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