Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    cwwaicw311 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    75

    Pass a value from a query to a form

    Hi,

    I have got 10 Item and each item have their own InvIN, InvOUT and Balance. I use 10 query to divide all 10 of the item and calculate the balance of each of the item in their respective query.



    N in the form i have created a textbox to show the Sum of the Balance when one of the item is choose from my Item Combo box in the same form.

    For example: Item A have 3 record in it balance 10 ,20 and 30. So in the form i choose Item A from my Item Combo box. Thus, the Sum of the Balance textbox in my form would show 60.

    How do i do it...??

  2. #2
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    Dim intStock as integer 'Please use Long if the numbers expected is Greater than 32,767
    Dim intInvIn as integer
    Dim intInvOut as integer

    intInvIN=iif(isNull(DSum("[InvIN]","Transaction","[InventoryID]="& Me.Combobox1)),0,DSum("[InvIN]","Transaction","[InventoryID]="& Me.Combobox1))

    intInvOut=iif(isNull(DSum("[InvOut]","Transaction","[InventoryID]="& Me.Combobox1)),0,DSum("[InvOut]","Transaction","[InventoryID]="& Me.Combobox1))

    'I have assumed that InvIN and InvOut is in the same table. This will work if you maintain seperate tables just change the table name


    intStock=IntInvIn-intInvOut

    Me.TextBox1=intStock

  3. #3
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    is your problem solved then please mark the thread solved.

  4. #4
    cwwaicw311 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    75
    Hi,

    Where should i put this code at...?? After update event on my Item Combo box...?? I have try it on After Update event for my Item Combo box but not working...

  5. #5
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931

    Stock

    I am attaching a sample mdb file I have attached the above code to the AfterUpdate event of a combobox. Check out the Stock Form.If your problem is solved mark this thread solved.

  6. #6
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    checked out the sol

  7. #7
    cwwaicw311 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    75
    I still cant able to do it... I have attached my database here. Hope you could find out what is the problem.

    I have done some changes to my work so it would be a bit different. I use Inventory Tracking System Main Menu to choose 1 type of InventoryType where onclick it will open the Inventory Tracking Table Form(Transaction) and the InventoryType value would bring to the InventoryType textbox rather than a combo box.

    Thanks...

  8. #8
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    please save the database in access 2000 format and upload coz I am in the office and we use Access 2000

  9. #9
    cwwaicw311 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    75
    Attached is 2000 format.

  10. #10
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    I have addressed most of the Issues that you had:
    1) Machines Pertaining to a particulat Inventory will be available for selection.
    2) Stock will be displayed at the Form Header.
    3) Stock is Update immediately after a transaction.



    I have made some changes to your database, Added a few fields and changed the names of a few. In the Inventory_Tracking_Table_Form Form I have put a Insert Button. It uses SQL to Append Data to the table. Type data in your form and Click Insert Button. This Button also updates the stock for the inventory.


    Suggestion: I think you should record Issue and Received Inventory in a seperate tables. I assume Issue is purchase of Inventory. Inclusion of re-order level is also necessary. You need to generate opening and closing stock also. if this database is related to process or contracts then you need to tag them. User should be able to see how much inventory is going in a process, Inventory used and un-used inventory returned.

    if this solves your problem mark the thread solved.

  11. #11
    cwwaicw311 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    75
    Hi,

    Thank you very much... this solve the problem i faced. According to your suggestion, I was thinking about when one of the inventory reach it minimum balance I wanted the Item Name, date and few other info to display at Inventory_Tracking_System_Main_Menu as a reminder. I able to use query to show it when reach limit. However, when the item is replenish i cant make the record disappear since i dun need to remind them to replenish the item.

  12. #12
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    I think you should mark this thread solved. As for the minimum stock balance prompt I will post it in the other thread that you have posted in queries. Plz mark the thread solved.

  13. #13
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    can you give me eact what details you want to show. Have you thought of splitting the Inventory_Tracking table to record issue and Receive inventory seperately

  14. #14
    cwwaicw311 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    75
    Hi,

    The information i wan to show in Inventory Tracking System Main Menu is the inventorytype, date, operatorname and balance when the balance of the inventory reach the minimum unit.

    I have not thought about splitting the 2 table before, but if they split, would it affect the way where i want to enter the data in only 1 form...?? If it does not affect and it would make the database work smoothly then splitting the table would not be a problem.

    Thank.

  15. #15
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    No it won't be a problem believe me life is going to be much easier for you. as for your minimum balance prompt I have already worked it out need to test a bit to see if its working OK will it be a problem if I post it on Monday. more over I wanted to ask you this database be a single user or a multiuser application.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Pass data from one form to another
    By Bruce in forum Forms
    Replies: 16
    Last Post: 02-25-2013, 03:59 PM
  2. pass value from one form to another
    By ManC in forum Forms
    Replies: 7
    Last Post: 11-25-2011, 09:59 AM
  3. Pass a value from a form to another
    By cwwaicw311 in forum Forms
    Replies: 3
    Last Post: 03-16-2010, 12:42 AM
  4. Pass a Parameter From a form to a Query
    By DDillesha in forum Forms
    Replies: 1
    Last Post: 10-28-2009, 12:49 PM
  5. I want to automatically pass a value to a query
    By Slategrey252 in forum Queries
    Replies: 1
    Last Post: 10-01-2009, 05:38 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