Add data in next row by using form in live

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • amiraSehhuri
    New Member
    • Jan 2016
    • 4

    #1

    Add data in next row by using form in live

    Hi all, I'm freshie in Microsoft Access (VB). Hope you guys can enlighten me.

    I'm trying to develop database and facing few problem. When i want to add data by using form, the data will overwrite the old data in table.
    In form have sub-form which i want it's live update but it's said "Syntax Error in Insert statement"
    Below are the coding that i used.

    Code:
    Private Sub cmdAdd_Click()
    Dim strSQL As String
     
       strSQL = "INSERT INTO Access_Fullsite (Site ID, Current Band) VALUES (" & Me!SiteID & ", '" & Current_Band & "');"
       DoCmd.RunSQL strSQL
       Access_FulSite_Subform.Form.Requery
       Me.Requery
       
    End Sub
    When i checked the table it's overwrite. Please help me.

    Thanks in advanced,
    Amira
  • Seth Schrock
    Recognized Expert Specialist
    • Dec 2010
    • 2965

    #2
    If there are spaces in the field names (which I don't recommend) then you need square brackets around the name ([Site ID], [Current Band]).

    Comment

    Working...