Results 1 to 8 of 8
  1. #1
    Join Date
    Nov 2006
    Posts
    40

    Unanswered: How to create a static negation sign (-) in a textbox

    Hi community experts,

    Environment
    MS Acess, visual basic

    May i knw whether is there a way to create a static negation sign (-) in a textbox? Is that a possiblity that this can be done using expression builder or code wise. If so hw it be achieve? It mean that whenever the form is being loaded, the negation sign will be there and it mux be static. tks

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Try using a mask ... Input mask to be specific.
    Back to Access ... ADO is not the way to go for speed ...

  3. #3
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    If all values are to be negative, always...
    Then you could try concatonating it as two strings.

    - GeorgeV
    George
    Home | Blog

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by georgev
    If all values are to be negative, always...
    Then you could try concatonating it as two strings.

    - GeorgeV
    But the minus sign can be edited or removed then ... A mask cannot be ...
    Back to Access ... ADO is not the way to go for speed ...

  5. #5
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Quote Originally Posted by M Owen
    But the minus sign can be edited or removed then ... A mask cannot be ...
    true...
    Well then - what about an after update event that concatenated the value with a minus sign!
    George
    Home | Blog

  6. #6
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    If the first character in the input mask is a minus sign, the minus sign will appear when you enter data, and cannot to deleted later. You cannot just have a minus sign however; it must be something on the order of

    -9999
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  7. #7
    Join Date
    Nov 2006
    Posts
    40
    Hi Georgev care to share what u are implying at the afterupdate event?

    HI guys tks for the response. To make it simple what i need is to display the negative sign in the textbox and it must be permanently there, which mean that user are not able to edit that negation sign ("-"). Whenever the form is loaded that negative sign must be there.

    The purpose of the textbox in this context is used to accept a numerical value, which mean that when the user save the data to the table, the sign together with what have been entered in the textbox will be displayed.

    I have tried with what some of the experts in this post have suggested such as mask and greater than 0 in the validation rule but it seems to have macro error and no value can be entered.

    What i am thinking is to use the expression builder to achieve but still trying hard on that expression.

    Ex: Textbox1
    Permanent negative sign (-)
    value for the textbox - (2)
    Overall it will become -2

    This are the what have tried so far but to no avail.
    Load event . Me.TextBox1 = "-"
    Got Focus - Me.TextBox1 = "-"
    Validation rule - < 0
    ControlSoure - ="-"
    input mask = "-"

  8. #8
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    give this a try:

    Code:
    Private Sub <field>_AfterUpdate()
    
    Dim myVariable as string
    
    myVariable = Me.<fieldname>
    Me.<fieldname> = "-" & myVariable
    
    End Sub
    - GeorgeV
    George
    Home | Blog

Posting Permissions

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