Results 1 to 7 of 7
  1. #1
    sprtrmp is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Location
    Greenville, SC
    Posts
    102

    Form shows incorrect quantity in text box


    bear with me, I am a relatively new Access user. I have a simple table that has a "quantity" field that I have filled with test data. That table is tied to a form (through a query). when I open the form, there is a combo box that looks up records based on the selection in the combo box. Most of the selections in the combo box result in the correct quantities being shown in the "quantity" textbox on the form, but some of them are incorrect. in other words, what shows up in the text box is not the quantity for that record in the table. Any ideas?? Thanks in advance!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Need to review data structure and form design and combobox properties. If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    sprtrmp is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Location
    Greenville, SC
    Posts
    102
    Inventory.accdb
    Alrighty, db is attached, and I have stripped it down to only include the table/query/form I am having trouble with. On the "miscAdd" form, there is a combo box labeled "Miscellaneous Items" choosing an item in the dropdown SHOULD cause the quantity in the "quantity" box to change to the quantity on the "Misc" table. However, for the first 2 items the quantity does not change from the default value of "0" until you select the 3rd, 4th, or 5th item on the list. if you select either of the last 3 items on the list, the quantity changes, but if you select one of the first 2 on the list AFTER either of the last 3, the quantity does not change. It seems to be a problem JUST with the first 2 items. I appreciate any help you can give. THANKS!!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    As a hint, I'll restate the problem. You say it doesn't work for the first two, I say it doesn't work for the two with apostrophes in the description. It's not that the quantity doesn't change, it's that the macro to go to the specified record fails because of the apostrophe.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    The WHERE condition is like the WHERE clause of an SQL statement. Apostrophe and quote marks in data can be an issue when programmatically constructing SQL statements because they have special meaning in SQL. Handle the apostrophe with Replace().

    ="[Nomenclature] = " & "'" & Replace([Screen].[ActiveControl], "'", "''") & "'"

    Doubling the apostrophe is called 'escaping' special character. It forces the SQL to treat it as simple text, not a special character.

    However, if you referenced the ID instead of Nomenclature, this would not be an issue. Use a multi-column combobox, review http://datapigtechnologies.com/flash...combobox3.html

    Should also review http://allenbrowne.com/AppInventory.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    sprtrmp is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Location
    Greenville, SC
    Posts
    102
    Are you kidding?? well... my face is red!!!
    All I can say is "DUH"

    Thank you both for your help, I figured it would be something simple I was missing.

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problem and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. DLookup text box on form shows error
    By Abacus1234 in forum Forms
    Replies: 8
    Last Post: 04-28-2015, 03:01 PM
  2. Replies: 1
    Last Post: 04-09-2015, 05:13 PM
  3. text box shows time frozen intermitantly
    By trevor40 in forum Forms
    Replies: 11
    Last Post: 03-09-2015, 05:37 PM
  4. Lookup field shows ID # and not text
    By kelkan in forum Forms
    Replies: 3
    Last Post: 01-26-2013, 09:19 PM
  5. Text box shows ID field and not the Name
    By jzacharias in forum Access
    Replies: 5
    Last Post: 10-18-2012, 10:24 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