Results 1 to 14 of 14
  1. #1
    Join Date
    Aug 2003
    Posts
    39

    Unanswered: "Name? Error in Control Source (Text Box)

    Hi everyone looking for a little help again.

    I have a form based on a query which prompts the user to enter an account number.

    I have a subform linked by accoubnt number that contains the amount in each account. In the subform footer I have a text box that sume the amount in the account selected. (=sum([Amount])).

    On my main form I have a text box that should pull the sum for the account specified (=[Forms]![frmCurrentGABalanceDetail subform]![SumAmount]).

    All this was working beautifully unitl I changed the source of my subform. I checked to make sure my fields were linked and they are. Just to test I tried pulling the data from the text box on the subform without any criteria and I still get the #Name? error.

    Any ideas?

    Thanks!

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    careful with the naming here!

    your subform is called whatever the parentform thinks the subform is called...

    ...this may have NOTHING to do with the name of the subform when you look at it in the main access box thingy (don't actually know what to call this thingy - its the one with tabs for tables/queries/forms/reports etc, "the database window"?)

    design view the parent, click once in the subform area to attract it's attention, and then check properties/other/name: that's what the parent form thinks your subform is called and it doesn't change after a .sourceobject

    in my opinion, mr gates has let us all down again by defaulting this properties/other/name name of a subform to the name of the form that you first drag in as a subform in design view. my knee-jerk reaction is to change this default name immediately into something like ParentsubForm.

    so, in case i have confused you even more. imagine three forms:

    form1
    form2
    form3

    drag form2 into form1 as a subform
    (you refer to the controls as forms!form1!form2.....

    at runtime, in form1 you .sourceobject=form3 the subform
    you STILL refer to the subform controls as forms!form1!form2.....
    dumb or what?

    following my knee-jerk renaming, the subform controls are always:
    form1!form1subform.... however many .sourceobject i use

    i am probably slightly less insane as a consequence!

    izy

  3. #3
    Join Date
    Aug 2003
    Posts
    39
    I don't think that is the issue here. Just for kicks I created two forms.

    frmHi
    frmBye

    In frmHi I created a text box and set the datasource to ="Hi"
    I then created a second text box to see if it would pick up the data in the first text box. I set the data source to =[txtHi]

    In frmBye I created a textbox to see if I could pickup txtHi in frmHi. I set the data source to =[Forms]![hi]![txthi].

    I still recieved the #name? error.

    Any thought on what would cause this?

  4. #4
    Join Date
    Jul 2003
    Location
    Italy
    Posts
    139
    Shouldn't

    =[Forms]![hi]![txthi]

    be

    =[Forms]![frmHi].[txtHi] ????


    Careful with names....
    Marco
    ---Do not send e-mail---
    "New Big Bang Theory: God said unzip universe"

  5. #5
    Join Date
    Aug 2003
    Posts
    39
    Originally posted by Marco Del Corno
    Shouldn't

    =[Forms]![hi]![txthi]

    be

    =[Forms]![frmHi].[txtHi] ????


    Careful with names....
    Sorry I just mistyped it. I wish it was just a naming error

  6. #6
    Join Date
    Jul 2003
    Location
    Italy
    Posts
    139
    I don't want to repeat myself (I might be VERY wrong) but when you got ?name error the problem is with naming. Be sure the datasource is absolutely correct. To check if is a naming problem try to use VBA... debug is much better with it.
    Marco
    ---Do not send e-mail---
    "New Big Bang Theory: God said unzip universe"

  7. #7
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Using your example below (frmHi, frmBye)

    If frmHi is a subform in frmBye, and you want to reference the
    value in control txtHi in frmHi, this should work:

    =frmHi.Form!txtHi
    Inspiration Through Fermentation

  8. #8
    Join Date
    Aug 2003
    Posts
    39
    Originally posted by RedNeckGeek
    Using your example below (frmHi, frmBye)

    If frmHi is a subform in frmBye, and you want to reference the
    value in control txtHi in frmHi, this should work:

    =frmHi.Form!txtHi
    Still not working. I've attached a sample file if anyone is willing to take a peak.
    Attached Files Attached Files

  9. #9
    Join Date
    Jul 2003
    Location
    Italy
    Posts
    139
    See my solution

    Obviously the two forms must be open at the same time!
    Attached Files Attached Files
    Marco
    ---Do not send e-mail---
    "New Big Bang Theory: God said unzip universe"

  10. #10
    Join Date
    Aug 2003
    Posts
    39
    Originally posted by Marco Del Corno
    See my solution

    Obviously the two forms must be open at the same time!
    Right. So now this worries me more. It worked last time I opened the form. So i was very happy. But now it works at times and not at others. Any clue as to whats going on?

  11. #11
    Join Date
    Jul 2003
    Location
    Italy
    Posts
    139

    Smile

    Originally posted by wauger20
    Right. So now this worries me more. It worked last time I opened the form. So i was very happy. But now it works at times and not at others. Any clue as to whats going on?

    I don't understand you now. You talked about forms and subforms, but in your sample there wasn't one. The two forms I found in the sample 'links' each other perfectly. You MUST have the two forms opened, and not just that. It MUST be that the form taking info from the other must be opened after the other (sorry but I don't remember which one is which at the moment).

    I hope I made it clear... or probably I don't understand your problem...
    Marco
    ---Do not send e-mail---
    "New Big Bang Theory: God said unzip universe"

  12. #12
    Join Date
    Aug 2003
    Posts
    39
    Obviously that was just a test file. I was testing to make sure I wasn't going insane and that I could do a simple function of referencing a control source. Now I think the problem lies elsewhere because:

    Sometime when I open the form it functions properly and at other times it randomly gives me the #Name error.

    Obviously the form links the text boxes correctly because the form will work.

    Now the problem is to determine why sometimes it doesn't.

    Sorry for all of the confusion but I do appreciate any help that I can get.

    Thanks

  13. #13
    Join Date
    Jul 2003
    Location
    Italy
    Posts
    139

    Wink

    This is my last attempt. Hope it makes clear how it works.

    SEE THE ATTACHED FILE!
    Attached Files Attached Files
    Marco
    ---Do not send e-mail---
    "New Big Bang Theory: God said unzip universe"

  14. #14
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    I downloaded your sample, and made this work...

    In frmHi, put the following code in it's OnCurrent event:

    Forms!FRMBYE.Refresh

    I tested this by creating a table, binding frmHi to the table, and
    txtHi to the field in the table. With both forms open, as I scrolled
    through the records in frmHi, the value in frmBye would change.

    If frmHi is closed, you'll always see ?Name in frmBye.
    Inspiration Through Fermentation

Posting Permissions

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