Results 1 to 7 of 7
  1. #1
    Cafofo is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2012
    Posts
    4

    Add data to table using form

    Hi all,



    Here is my try in .zip file !

    I want to do that : i have an Table with 2 fields FIRST and SECOND.

    Using a Form, i Open this table ( and what already have been added there ) , and using Add button , Exclude button, Edit button at the Form , make those actions on table.

    I was trying but unsuccessfully... what can i do ? im really new using access =(
    can someone help me please ?
    Thank you =)

    test.zip

  2. #2
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    1. There is no data in your table.
    2. If you create your form using the 'Form Wizard', you will automatically be able to add, change and delete data.

    Then - if you want to add buttons to your Form, as soon as you drop a button onto the Form, the button wizard will come up to help you configure the button to do what you need.

    Perhaps I am not understanding your problem. Can you explain with a little more detail?

    I just put some data into the table and opened the Form [A1]. It shows all the data I added.
    I was also able to add rows of data, delete rows and change data in there.
    You don't HAVE to have buttons, but it's pretty easy to add them.

  3. #3
    Cafofo is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2012
    Posts
    4
    I dont know how to use button wizard... but ill try to be more specified

    Ive already put those " + " and " - " buttons, as ADD or REMOVE.

    I Just want to add datas using Table when the button are pressionade. Some Window comes with " Add things at FIRST " and after " Add Things at SECOND ".Only when using "+" button... and removing/editing when using and " - " button or edit button.
    And nothing writing the fields at the form directly at the subform.

    Hope you got the idea !

    Thank you !

  4. #4
    Cafofo is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2012
    Posts
    4
    Here is some idea about the code for Addbutton

    Private Sub cmdAdd_Click()

    Dim rstA1 As dao.Recordset
    Dim strA1 As String

    strA1 = InputBox("Write First", "Add First")

    If strA1 = "" Or IsNull(strA1) Then
    MsgBox "Not Valid"
    Exit Sub
    End If

    If Not IsNull(DLookup("First", "tblA1", "First='" & strA1 & "'")) = True Then
    MsgBox "Already Exist"
    Exit Sub
    End If

    Set rstA1 = CurrentDb.OpenRecordset("SELECT * FROM tblA1")

    rstA1.AddNew

    rstA1![First] = UCase(strA1)

    rstA1.Update
    subA1.Form.Requery
    subA1.Form.Refresh
    End Sub

    But... having problens at some part... and it shows just one Input box for "FIRST" field, its need an another for " SECOND " i still donīt know how to continue

  5. #5
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    I dont know how to use button wizard...
    To use the Button Wizard -> just put a new button on your form.
    A 'Dialog Box' will come up and it will have the words 'Command Button Wizard' on top.
    That is the Button Wizard.

    Then - If you want the button to do something with the data in the Table, then you should choose 'Record Operations' from the 'Categories' side of the box.
    When you click on 'Record Operations' - you will see all the possible actions the button can do under 'Actions:'.
    You can just pick the one you need - and Access will do the rest for you - follow the prompts.

  6. #6
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    it shows just one Input box for "FIRST" field, its need an another for " SECOND " i still donīt know how to continue
    Just like you wrote the code for the 'FIRST' [with strA1 . . .], you will have to put in code to show a second Input Box.

    Also - are you sure that this works ???:
    Code:
    If Not IsNull(DLookup("First", "tblA1", "First='" & strA1 & "'")) = True Then
    MsgBox "Already Exist"
    Exit Sub
    End If
    I tried it and it does not do what I was expecting.
    It works if I take out the '= True':
    Code:
    If Not IsNull(DLookup("First", "tblA1", "First='" & strA1 & "'")) Then
    MsgBox "Already Exist"
    Exit Sub
    End If
    Let's pick one problem at a time and work through your code.

    So . . . pick one problem that you want to fix next & I will try & help with it.

  7. #7
    Cafofo is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2012
    Posts
    4
    well... it works by half.

    Open my Access file Attached

    IF the table are empty it works OK ! ( just putting at FIRST )

    but after that, if i try to add a new one, i got error at the line " If Not IsNull(DLookup("First", "tblA1", "First='" & strA1 & "'")) = True Then " WITH and WITHOUT " = TRUE "

    test.zip

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

Similar Threads

  1. Replies: 11
    Last Post: 07-24-2012, 07:50 PM
  2. Replies: 7
    Last Post: 04-22-2012, 02:28 PM
  3. Replies: 4
    Last Post: 02-27-2012, 10:29 AM
  4. Replies: 4
    Last Post: 12-22-2011, 03:04 AM
  5. Replies: 4
    Last Post: 01-05-2011, 07:56 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 - Senior Forums