Results 1 to 2 of 2
  1. #1
    pedie is offline Novice
    Windows Vista Access 2007
    Join Date
    Dec 2010
    Posts
    5

    Updating my table through VBA.

    have a Table called is Mytable & Form2 which has Name (textbox renamed) and text2. I have a button when clicked, i want the name info & text2 values to be updated in table1 col 1 and two. Col 1 name/header = Name & col2 = "EMP IDS".



    Thanks for helping. Very new so I have explained in detail. Hope someone can help. Thanks again


    Code:
    Private Sub Command4_Click()
    Dim x As String, y As Long
    x = Me.NameT.Value
    y = Me.Text2.Value
    
    Mytable("Name").Value = x
    Mytable("Emp IDS").Value = y
    Mytable.Update
    End Sub
    

  2. #2
    ivancp is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    3

    Thumbs up

    You can use SQL:

    Code:
    Private Sub Command4_Click()
        Dim x As String, y As Long, strSQL as String
        x = Me.NameT.Value
        y = Me.Text2.Value
        strSQL = "UPDATE Mytable SET Name = '" & x & "' ,  [Emp IDS] = " & y
        currentDb.Execute strSQL    
        End Sub

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Updating an Existing Table
    By jo15765 in forum Access
    Replies: 2
    Last Post: 11-21-2010, 09:11 PM
  2. updating an imported table
    By cmul in forum Access
    Replies: 3
    Last Post: 08-20-2010, 03:24 AM
  3. Table not updating (Anyone Please Help)
    By goyal_cyber in forum Queries
    Replies: 7
    Last Post: 05-28-2010, 09:42 AM
  4. updating a table from a form.....
    By softspoken in forum Access
    Replies: 7
    Last Post: 04-21-2010, 09:04 AM
  5. Updating a table from a form
    By Lynn in forum Forms
    Replies: 3
    Last Post: 03-18-2010, 10:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums