Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2002
    Posts
    17

    Question Unanswered: Possible to make Me.txtTotal & "June" ???

    Hello,

    I've a problem. Is it possible to use this statement: Me.txtTotal & "June" ? I need it for a function but it doesn't work:

    dim iValue as TextBox
    iValue = Me.txtTotal & "June"
    iValue = 1000


    Can somebody help me with this???


    Thanks!

  2. #2
    Join Date
    Jul 2002
    Posts
    67
    Your variable iValue can't be Me.txtTotal and 1000 at the same time. What are you exactly trying to do here? Let us know so we can get a better idea, so we can help.
    Don't do today, what can be done tomorrow.

  3. #3
    Join Date
    Aug 2002
    Location
    Québec, Canada
    Posts
    109
    Right now, you create a TextBox (that do not have sense here), and then you affect the value of the textbox to the value of another textbox and "June", so it could looks like "566June" if the txtTotal was 566, but then you put 1000 over it, you txtTotal is not changed, and you iValue (a textbox) is destroyed at the end of the sub

    Code:
    dim iValue as TextBox
    iValue = Me.txtTotal & "June"
    iValue = 1000
    Maybe you could try that:

    Code:
    dim strValue as string
    strValue = Me.txtTotal.Value & " June"
    strValue = strValue & "(1000)"
    msgbox strValue
    This is probably not what you want to do, please explain further...

    JefB

  4. #4
    Join Date
    Oct 2002
    Location
    UK
    Posts
    21

    Re: Possible to make Me.txtTotal & "June" ???

    Originally posted by Luk
    dim iValue as TextBox
    iValue = Me.txtTotal & "June"
    iValue = 1000
    Me.txtTotal & "June" returns a String value equal to the value of your txtTotal TextBox with "June" concatenated on the end. You can't set iValue to this value because it's of type TextBox. What you can do is set iValue to be an existing TextBox first, then set the value of that TextBox to Me.txtTotal & "June"...

    dim iValue as TextBox
    Set iValue = Me.txtAnotherTextBox
    iValue = Me.txtTotal & "June"
    iValue = 1000

    Although this code snippet will only set the value to 1000 since you're assigning that immediately afterwards...

    If you want a variable with the value Me.txtTotal & "June", then you need this:

    dim iValue as Variant
    iValue = Me.txtTotal & "June"
    iValue = 1000

    A Variant type will accept String or Numeric values which you can reference later in your code.

    Hope this is of some help, although like Slacker I'm not sure what you're trying to do

Posting Permissions

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