Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2004
    Posts
    361

    Unanswered: populate unbound text box

    Hi everyone, is it possible to populate an unbound text box with data that is calculated in a query. I have 6 functions associated with 6 text boxes that I will hide in the form. Hopefully when one out of the four populates in will show the value in the visible text box. Any help will be apprciated.

    Thanks!

  2. #2
    Join Date
    Jan 2004
    Location
    Toronto, Canada
    Posts
    259
    cant u just do that in your function call? find the most appropriate data from all the six text boxes and then populate the Me.TextMostApppriate With that

  3. #3
    Join Date
    Mar 2004
    Posts
    361
    Ok i got it to populate. That was easy. Didn't use my brain to much. The next problem I have is something like this. Only one of the 6 text boxes will ever be populated. How do I write a statement that says if [textboxname]=null then show [textboxname] and if that is null show something until you have a value?

    Thanks.

  4. #4
    Join Date
    Apr 2004
    Location
    Kingsland, Georgia
    Posts
    231
    can you restate that last sentence one more time? kinda confusing. i get from it that you look at the first textbox, and if the value in it is null, then you show it, or move to the next textbox and check it? thanks.

  5. #5
    Join Date
    Jan 2004
    Location
    Toronto, Canada
    Posts
    259
    let meget this correct: of eg. 6 textboxes you have on the form, choose the one that is NOT NULL and put its value into this central checkbox;

    you could do it like this.
    make sure to change the textboxcentral to depict ur central textbox.
    this assumes that the rest of the textboxes are named as "TextBox" & 1 or 2 or 3....

    Code:
     
    Dim cont As Control
    For Each cont In Me.Controls
       If Mid(cont.Properties(0), 1, 4) = "Text" Then
            If cont.OldValue <> "" Then
                Me.TextBoxCentral.Value = cont.Oldvalue
                Exit for
            End If
        End If
    Next

  6. #6
    Join Date
    Mar 2004
    Posts
    361
    I think I found a simplier way. I just need to sum the values from those 6 text boxes. I have written this so far.

    MVP Factor: [2001 Miles]+[1999 Miles]+[2000 Miles]+[986320]+[986310]+[996110]+[996310]+[996410]+[996610].

    The only problem I have is it just shows the values without suming them. I tried to put a sum infront but it gave me an error. How should I add these columns up?

  7. #7
    Join Date
    Mar 2004
    Posts
    361
    I also tried "[Blah]" format but that didn't work either. Is it possible to sum these type of fields at the form or query level?

Posting Permissions

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