Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    527
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can't find Subform! (AXP)

    I have a pop-up form that I am using to add some data to a table. On another form, the main one in the background, I have a subform that shows the data. I am trying to requery the subform after adding data but it gives an error that says it can't find the subform. Here is the code I am running right there. Does anyone have any ideas?

    Public Function Expense_Requery()
    DoCmd.Requery (Forms![sbfJobExpenses])
    End Function


    Thanks,
    Mark Santos

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Can't find Subform! (AXP)

    You need to refer to the subform using this syntax:
    Forms![mainform]![subform].Form.Requery
    [subform] needs to be the name of the subform control in the main form (which may oir may not be the same name as the actual subform)
    Edited by John
    I noticed after posting that you had used docmd.requery. this code will work with that

    Dim ctlform As Control
    Set ctlform = Forms![mainform]![subform]
    DoCmd.Requery ctlform.Name
    Regards
    John



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •