Results 1 to 5 of 5
  1. #1
    duckie10 is offline Novice
    Windows Vista Access 2007
    Join Date
    May 2009
    Posts
    16

    SubForms

    strSQL = "SELECT ONHAND " & _


    "FROM Inventory " & _
    "WHERE [INVENTORY ID] = '" & [INVENTORY ID].Value & "'"

    rs.Open strSQL, cn, adOpenForwardOnly, adLockReadOnly, adCmdText

    Do While Not rs.EOF

    If rs.Fields("ONHAND").Value >= Qty_Orderd_int Then
    Me.[Qty Shipped] = Me.[Qty Ordered]
    Me.[Qty Back Ordered] = 0
    INVENTORY.OnHand.Value = rs.Fields("ONHAND").Value - Qty_Ordered_int

    INVENTORY--is the subform
    OnHand--is the field in the subform

    I am getting run time error 424
    Object required

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Instead of:
    INVENTORY.OnHand.Value = rs.Fields("ONHAND").Value - Qty_Ordered_int
    ...try...
    rs.Fields("ONHAND").Value = rs.Fields("ONHAND").Value - Qty_Ordered_int

  3. #3
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Hmm...you may also want to review this link:
    Forms: Refer to Form and Subform properties and controls
    Even though Access defaults it that way, you should rename your controls so there are no duplicate names and thus confusion.

  4. #4
    duckie10 is offline Novice
    Windows Vista Access 2007
    Join Date
    May 2009
    Posts
    16
    I put in this code

    rs.Fields("ONHAND").Value = rs.Fields("ONHAND").Value - Qty_Ordered_int

    I received run time error 3251

    Current recordset does not support updating. This may be a limitation of the provider, or of the selected locktype

    How do I fix it?

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    It looks like you are using ADO which I'm not familiar with. In DAO you need to issue an rs.Edit first and the an rs.Update after the change is made. You may also have a problem with a ForewardOnly type recordset. I tend to use a DynaSet in DAO.

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

Similar Threads

  1. Replies: 0
    Last Post: 10-21-2008, 10:51 PM
  2. Making subforms editable
    By ashiers in forum Forms
    Replies: 7
    Last Post: 10-08-2008, 04:09 PM
  3. Subforms
    By henryclay in forum Access
    Replies: 0
    Last Post: 07-24-2007, 07:51 AM
  4. SubForms to Parent
    By henryclay in forum Forms
    Replies: 2
    Last Post: 10-27-2006, 07:14 AM
  5. Control addressing on subforms
    By JB in forum Access
    Replies: 1
    Last Post: 12-09-2005, 09:14 PM

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