Results 1 to 5 of 5
  1. #1
    A Abbas is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    4

    Can somebody review the code in attached database?

    This is a lab inventory database, which is taking transaction details as input and calculates the amount of the item and updates the stock. For this i have written the code. It was working fine but suddenly dont know where I messed up the code or any property settings it is not running. Im unable to figure it out. I will be grateful if someone can look into this, its really urgent.


    Thanks.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    This code is expecting a number value from cboItem but it is getting the text Item because the BoundColumn is set to the Item instead of ID.
    Set rsLabInv = dbLabInv.OpenRecordset("Select ID, Item, RatePerUnit, InStock from Inventory Where ID = " & cboItem)

    Inventory Transactions is saving the inventory Item value instead of the inventory ID primary key. If you are not going to use the autonumber primary key as foreign key, then change Item to primary key. If you do want to use the autonumber then the Item field in Inventory Transactions needs to be a number field and cboItem BoundColumn should be set to 1, the ID column.
    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
    A Abbas is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    4
    I just changed bound column = 1 n it worked. I did this before also but dont know why it failed. Can you kindly tell me how to display item name instead of item id in the datasheet form?
    Thanx

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Review these tutorials, especially the 3 on comboboxes. You want a multi-column combobox. http://datapigtechnologies.com/AccessMain.htm

    You still need to address the PK. Item in Inventory should be PK and set not to allow duplicates. The Autonumber fields are not being used as PK/FK.
    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.

  5. #5
    A Abbas is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    4
    Thankyou so much, this tutorial is really good...helped me alot. Im new to Access n I dont know much about vba too. thanks for your help.

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

Similar Threads

  1. Review Cycles
    By Luke in forum Access
    Replies: 1
    Last Post: 07-19-2011, 12:38 PM
  2. Replies: 6
    Last Post: 06-27-2011, 07:11 PM
  3. review my database
    By simba in forum Access
    Replies: 0
    Last Post: 06-20-2011, 08:40 AM
  4. BD Structure (review)
    By Bryan021 in forum Database Design
    Replies: 0
    Last Post: 05-26-2011, 11:39 AM
  5. Replies: 1
    Last Post: 07-09-2006, 09:23 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