Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    San Francisco, CA, USA
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Trapped in SubSubSubform Abyss (2002)

    I have a form frmJobCost.
    A tab Control TabJobCost on it:
    A tab with a subform 30100-frmLogIn-Tab-MainForm.
    Within this subform TabJobLog
    On the tab control a subform 30200-frmLogIn
    On this form are various control companyname etc.
    I have a button btNewCustomer.
    When I click the button I get this error message."You can't assign a value to this object"
    Some subform etc. has to be selected and the collection tranversed which I've tried several ways with no joy but fell over the abyss. HELP!
    Frank

  2. #2
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    352
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Trapped in SubSubSubform Abyss (2002)

    Hi again frank

    Is the form in design view or form view when you click the button and get the message? What is the code for the button's OnClick event? What does the error message actually say about traversing collections?

    If you can give us some more detail we will be glad to help.
    David Grugeon
    Brisbane Australia

  3. #3
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    San Francisco, CA, USA
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Trapped in SubSubSubform Abyss (2002)

    Well it's in form view and the message is You can't assign a value to this object."
    I think I'm not going to form when I push new record.
    Sort of like having to select the subform and then the control on the subform.
    I have so many tab controls and subforms I'm sort of lost. If I eliminate the tab on the final form I get the message on one of the subforms on this form.



    Private Sub btNewCustomer_Click()

    DoCmd.GoToRecord , , acNewRec
    DoCmd.GoToControl "CompanyName"

    Exit_btNewCustomer_Click:
    Exit Sub

    Err_btNewCustomer_Click:
    MsgBox Err.Description
    Resume Exit_btNewCustomer_Click

    End Sub

    Thanks
    Hope this sort of communicates.
    Frank
    Brisbane, California (Sister Cities)

  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    352
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Trapped in SubSubSubform Abyss (2002)

    I suspect the problem is not in this bit of code. When it breaks do you get a debug button? if so and you click debug what line of code are you on?

    If you cannot do it this way put

    msgbox "Here" between the two DoCmd code lines and see if it gets that far.

    You could change

    DoCmd.GoToControl "CompanyName"

    to

    Me.CompanyName.SetFocus

    but I don't see why that would be different.

    Oh, another thing, Is the control actually called "CompanyName"? Is this the same as the field name? If so it would be better to change it to tboCompanyName just to avoid you or Access getting confused.
    David Grugeon
    Brisbane Australia

  5. #5
    Lounger
    Join Date
    Mar 2002
    Location
    St Albans, Hertfordshire, England
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Trapped in SubSubSubform Abyss (2002)

    Frank,

    Which form are you trying to add the new record to?

    As David says, using the setfocus method is better than the goto control - however, I would take this a step further, and reference the entire form string - i.e. forms!form1!subformholder.form2!subform2holder.for m3!control.setfocus - check under help for referencing subforms, as I can't guarantee that my code is exactely correct, but it should at least point you in the right direction.

    I hope that adds value to your quest <img src=/S/trophy.gif border=0 alt=trophy width=15 height=15>!

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Trapped in SubSubSubform Abyss (2002)

    You didn't indicate which form has the button on it. If you click a button on a parent form, the focus shifts, so you can't just goto a control without specifying which form the control is on. If you are setting focus to a subform control from code running outside the subform, you need to set the focus to the subform *form* first and then to the control on the subform.
    Charlotte

  7. #7
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    San Francisco, CA, USA
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Trapped in SubSubSubform Abyss (2002)

    30200-frmJobLog

Posting Permissions

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