Using a Form to Update Records in Another Database

slkasulke

Registered User.
Local time
Today, 14:44
Joined
May 31, 2012
Messages
27
Hi Everyone,

To give you a little background on my project, I have a database that tracks products. Because we have a very slow WAN, I had to resort to a very round-about way of making a frontend and backend (instead of splitting). To get the information from the frontend to the backend, I have a button on a form that will delete the current tables in the frontend and replace identical tables from the backend that contains the most up-to-date information. This is working fine for what I need it to do, but I now need a way that I can edit information and insert new records.

As far as editing records, I have the following code, which... doesn't work.

Code:
Private Sub btnEdit_Click()
 
    Dim stSQL1 As String
    Dim db1 As dao.Database
    Dim rs1 As dao.Recordset
 
    stdbName1 = "C:\Users\N0216611\Desktop\Attachments\Projects" & "product_ref_library_backend.accdb"
   
    Set db1 = Workspaces(0).OpenDatabase(stdbName1)
     
    stSQL1 = "UPDATE tblProducts " _
        & "SET LineOfFocus = '" & Me.LineOfFocus.Value & "'," & _
        "ProductID = '" & Me!ProductID & "'," & _
        "ProductName = '" & Me!ProductName.Value & "'," & _
        "Status = '" & Me!Status & "'," & _
        "ContentOwner = '" & Me!ContentOwner & "'," & _
        "Category = '" & Me!Category & "'"
        stSQL1 = stSQL1 & " WHERE RowID = " & Me.RowID.Value & ";"
     
     db1.Execute stSQL1
     db1.Close
 
End Sub

Could anybody point me in the right direction?

Thanks in advance!
 

Users who are viewing this thread

Back
Top Bottom