Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    5 Star Lounger
    Join Date
    Jul 2004
    Location
    Ohio
    Posts
    629
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Carrying text feilds across forms (2k)

    I have a main form where one of the text fields is 'Title'. When you click on one of the buttons, a check list form opens up where once again, one of the text fields is 'Title', which is the same title from the previous form. However this checklist form does not contain every entry from the main form, it creates entries per main form item as required. What i want to do is carry over the 'Title' field from the main form to the checklist form so users don't have to enter repetitive data, but i am not sure how to do this.

    i tried putting in the button click procedure that brings up the main form, a line of code that does frmcheck.txttitle.text = me.txttitle.text but it gives me object must have focus error... so since the control has to have focus i tried to do it in the frmcheck_Load routine, but i got the same error. how can i go about doing this?
    <img src=/w3timages/blueline.gif width=33% height=2>
    <big>John</big>

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Carrying text feilds across forms (2k)

    You could try to leave off the .Text. If you just refer to a text box, you refer to its Value property; this is available if the control doesn't have the focus.

  3. #3
    4 Star Lounger
    Join Date
    Aug 2002
    Location
    Dallas, Texas, USA
    Posts
    594
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Carrying text feilds across forms (2k)

    Actually, I would recommend setting the textboxes default value to the main form's Title entry. That way, if they chose to not enter a record, you won't have an empty record with the Title in it. It will also carry over to new entries without anymore code involved.

  4. #4
    5 Star Lounger
    Join Date
    Jul 2004
    Location
    Ohio
    Posts
    629
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Carrying text feilds across forms (2k)

    hans, i tried this:

    Private Sub Form_Load()
    Me.Title = main.Text71

    End Sub

    text 71 is the main form's title feild
    i still get an Error saying object required

    <IMG SRC=http://error.jpg>
    Attached Images Attached Images
    <img src=/w3timages/blueline.gif width=33% height=2>
    <big>John</big>

  5. #5
    5 Star Lounger
    Join Date
    Jul 2004
    Location
    Ohio
    Posts
    629
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Carrying text feilds across forms (2k)

    Hans, i get this error: Object Required (run time error '424')

    and here is the short line of code i'm using to do it:

    Private Sub Form_Load()
    Me.Title = main.Text71

    End Sub

    main.text71 is the text field from the main form

    drew, i also tried what you recommended, but it just doesn't insert anything, i used the expression builder to get the field: default value "=[Forms]![Master List]![Text71]" (without the quotes)
    doesn't work for me though. i'm sure its me being dumb, but i don't see what i'm doing wrong here, or not doing.

    any other suggestions?
    <img src=/w3timages/blueline.gif width=33% height=2>
    <big>John</big>

  6. #6
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Schenectady, New York, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Carrying text feilds across forms (2k)

    Try
    Me.Title = forms.main.Text71
    Don
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18> <img src=/S/flags/NewYork.gif border=0 alt=NewYork width=30 height=18> "Life on Earth is expensive, but at least it includes a free trip around the Sun."

  7. #7
    5 Star Lounger
    Join Date
    Jul 2004
    Location
    Ohio
    Posts
    629
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Carrying text feilds across forms (2k)

    Don, that worked! thank you very much!

    is there any explanation on why i had to type in forms.name.text?

    edit: how do you do this if you have a space in the name of the form? ie: Name = "Main Form"
    <img src=/w3timages/blueline.gif width=33% height=2>
    <big>John</big>

  8. #8
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Schenectady, New York, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Carrying text feilds across forms (2k)

    Forms is the object it was looking for. This is necessary so that it knows what internal class to use. When it goes to obtain the value from your form it needs to call the Forms class and not a Query, Module, or Report class.
    Don
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18> <img src=/S/flags/NewYork.gif border=0 alt=NewYork width=30 height=18> "Life on Earth is expensive, but at least it includes a free trip around the Sun."

  9. #9
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Schenectady, New York, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Carrying text feilds across forms (2k)

    forms.[main form].text
    Don
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18> <img src=/S/flags/NewYork.gif border=0 alt=NewYork width=30 height=18> "Life on Earth is expensive, but at least it includes a free trip around the Sun."

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Carrying text feilds across forms (2k)

    Don already replied, but also see this very recent thread: <post#=392057>post 392057</post#>.

  11. #11
    4 Star Lounger
    Join Date
    Aug 2002
    Location
    Dallas, Texas, USA
    Posts
    594
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Carrying text feilds across forms (2k)

    On the on Open Event of the form, you would put:

    Me.Title.DefaultValue=Forms("Main Form").Text71

  12. #12
    5 Star Lounger
    Join Date
    Jul 2004
    Location
    Ohio
    Posts
    629
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Carrying text feilds across forms (2k)

    Don, is the method you are describing for VBA? because in the code builder window i get Error 438: Object doesn't support this property or method, and i've used the [ ]'s for expression builder many times because of my poor spacing names.

    Drew, the method you describe doesn't work for me in the Form_Load or Form_Open events. I don't get an error, but I don't see any value in it either.

    Hans, i checked out that other thread and it seems to be more for the expression builder than code builder? i don't know if its the same syntax or not across the two. But there was a link to a program in that thread that im now thinking about trying to find and replace the spaced names w/ a better formatted one.
    <img src=/w3timages/blueline.gif width=33% height=2>
    <big>John</big>

  13. #13
    4 Star Lounger
    Join Date
    Aug 2002
    Location
    Dallas, Texas, USA
    Posts
    594
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Carrying text feilds across forms (2k)

    Any way you could post a sample db with those two forms and some data. It would be easier to help that way.

  14. #14
    5 Star Lounger
    Join Date
    Jul 2004
    Location
    Ohio
    Posts
    629
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Carrying text feilds across forms (2k)

    Its a pretty ugly sample i just made, but it should explain what i mean fine. Type something into the main form 'Title' text feild, then click 'open other form' button. you should get an error 438 like i keep getting with it. i just want the title textbox text of the first form to appear in the title textbox of the other form.
    Attached Files Attached Files
    <img src=/w3timages/blueline.gif width=33% height=2>
    <big>John</big>

  15. #15
    5 Star Lounger
    Join Date
    Jul 2004
    Location
    Ohio
    Posts
    629
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Carrying text feilds across forms (2k)

    guys, thanks for all your help, but i tried that program from the other post Hans referenced to handle my stupidity. i found and replaced all instances of 'Main Form' and replaced it with 'Main', now i can call it easily. it seems to have worked, but i didn't get a chance to check everything yet. as of now i recommend the program too: http://www.rickworld.com/index.html
    <img src=/w3timages/blueline.gif width=33% height=2>
    <big>John</big>

Page 1 of 2 12 LastLast

Posting Permissions

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