Results 1 to 7 of 7
  1. #1
    Azhar is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Nov 2011
    Posts
    4

    form and subform


    I have a form that contains a subform. For every value selected i.e order number there is an option in subform to enter details of products that are being purchased. The products are selected using a combo box. I want to display the quantity of the item selected in an unbound text box. Can some one please help.

  2. #2
    pdebaets is offline Competent Performer
    Windows Vista Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Los Angeles
    Posts
    235
    Why do you want the quantity field to be unbound? That seems a bit odd.

    Anyway, open your subform in design mode and add a new textbox in the detail section. Name it "quantity". Leave the ControlSource property blank.

  3. #3
    Azhar is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Nov 2011
    Posts
    4
    Ok i figured out something....but it doesn't really works the way i want to...
    i used the following code

    Code:
    Private Sub Product_id_AfterUpdate()
    Dim val As String
     
    val = DLookup("Quantity", "Product", "ID = " & [Product_id])
    
    Me.QtyA.Value = val
    
    End Sub
    Where "Me" is the form. "QtyA" is the unbound textbox in the form. The problem is that each product i add, it gets the same value.

    Please check the attached file.


  4. #4
    pdebaets is offline Competent Performer
    Windows Vista Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Los Angeles
    Posts
    235
    Save yourself some time. Download the customer orders database example: http://office.microsoft.com/en-us/te...in=HA001034557

  5. #5
    Azhar is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Nov 2011
    Posts
    4
    I know there are samples available, i just wanted to learn a concept. Thanks anyway.

  6. #6
    pdebaets is offline Competent Performer
    Windows Vista Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Los Angeles
    Posts
    235
    You can learn a lot from reviewing the sample databases.

  7. #7
    Azhar is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Nov 2011
    Posts
    4
    Can we do the same thing without VBA, like using expressions...?

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

Similar Threads

  1. Replies: 5
    Last Post: 11-11-2011, 11:06 AM
  2. Form and subform
    By jcb267 in forum Forms
    Replies: 3
    Last Post: 10-03-2011, 08:41 AM
  3. Help with form/subform
    By srcacuser in forum Forms
    Replies: 3
    Last Post: 07-14-2011, 01:01 PM
  4. Replies: 6
    Last Post: 11-05-2010, 10:11 AM
  5. Replies: 0
    Last Post: 05-09-2010, 08:43 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