Results 1 to 6 of 6
  1. #1
    Business is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2016
    Posts
    78

    Updating table from a form

    Hi,
    I came across this problem qnd until now i do not find no solution.
    There is a table stock and table invoice,a form Invoice and two button save and update On the table stock there is productId and productName and productprice.
    The invoice table has InvoiceNumber,productId(For the relationship) and product name.
    Me.Modifiable13 is a combo box containing the productId,productPrice and productQuantity.
    On the invoice form i do not display the productId,Me.Modifiable13 display a name. But while updating the table and saving,the value of productname is a number and on productId there is a zero.
    Help please i have tried everything i know
    Codes
    strSQL = "UPDATE Stock Set [produitQuantite] = " & Me.Texte15 & " WHERE [produitId] = " & Me.Modifiable13


    CurrentDb.Execute strSQL, dbFailOnError
    Me.Texte15 = ""
    Me.Texte17 = ""
    Me.Texte19 = ""



    REGARDS

  2. #2
    DougsGraphics is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2016
    Location
    New Mexico
    Posts
    11
    What are you trying to do? You may get some useful responses if you provide some information about what you are trying to accomplish.

    Fundamentally, it appears that you are trying to update the fields using an SQL statement that does not relate your two tables, and trying to use a combo box that contains a mix of elements that don't help. I presume the Me.Modifiable13 reference is going to return an index that references the selected entry, not the entry.

    Do you really have the product name stored in both tables "stock" and "invoice"?

    You should consider a better naming convention for your form fields as "Texte15" is not at all descriptive.

    Give us some more information to work from so we can help.

    Note: Please use the code tags to set off your code

  3. #3
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,388
    The combo box contains 3 fields. You have to specify which you want to use. Zero is for the first item.
    Code:
    strSQL = "UPDATE Stock Set [produitQuantite] = " & Me.Texte15 & " WHERE [produitId] = " & Me.Modifiable13.selected(0)

  4. #4
    Business is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2016
    Posts
    78
    The texte15 can be called showStock. What i am trying to do is to update the stock form the new quantity that will be display after calculation in the showStock.
    Even with setting Me.Modifiable13.selected(0),the update does update the product stock but in the product table but on the invoice table while saving it does save a number still

  5. #5
    Business is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2016
    Posts
    78
    Quote Originally Posted by Business View Post
    The texte15 can be called showStock. What i am trying to do is to update the stock form the new quantity that will be display after calculation in the showStock.
    Even with setting Me.Modifiable13.selected(0),the update does update the product stock but in the product table but on the invoice table while saving it does save a number still
    Sorry i made a made a mistake,it does not update the table stock no more

  6. #6
    Business is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2016
    Posts
    78

    Thumbs up

    Thanks a lot at this forum it really helps find solutins

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

Similar Threads

  1. Replies: 12
    Last Post: 11-11-2014, 02:10 PM
  2. Updating table with changes in form
    By gemadan96 in forum Forms
    Replies: 2
    Last Post: 09-02-2013, 11:10 AM
  3. Updating main table from temp table AND form value
    By shabbaranks in forum Programming
    Replies: 8
    Last Post: 05-01-2013, 07:18 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