Results 1 to 11 of 11
  1. #1
    Join Date
    Feb 2004
    Location
    UK
    Posts
    246

    Unanswered: How do I implement ProperCase

    Hi,
    I have a text box on a form, how do I force the contents of this to be ProperCase?
    Sorry I should add that the text box is derived by the system

    Regards
    John
    Last edited by Sticker; 03-31-04 at 07:39.

  2. #2
    Join Date
    Mar 2004
    Location
    Brighton, UK
    Posts
    5
    A slightly simpler way would be to use the strConv function:

    Dim TmpString as string

    TmpString=MyTextbox.Value
    Mytextbox.Value=strConv(TmpString, vbProperCase)

    This code would probably be best located in Form_Current

  3. #3
    Join Date
    Feb 2004
    Location
    UK
    Posts
    246
    Hi,
    Thanks for the reply, but I have a the foloowing problem now,

    "This recordset is not updateable"

    I put the following lines of code in

    Private Sub Form_Current()

    Dim TmpString As String

    TmpString = User.Value
    User.Value = StrConv(TmpString, vbProperCase)

    End Sub

    the text box is called "User"

    The form is not bound to any table.

    Regards
    John

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Originally posted by Sticker
    Hi,
    Thanks for the reply, but I have a the foloowing problem now,

    "This recordset is not updateable"

    I put the following lines of code in

    Private Sub Form_Current()

    Dim TmpString As String

    TmpString = User.Value
    User.Value = StrConv(TmpString, vbProperCase)

    End Sub

    the text box is called "User"

    The form is not bound to any table.

    Regards
    John
    Does the textbox have a RowSource?

  5. #5
    Join Date
    Feb 2004
    Location
    UK
    Posts
    246
    Hi Mike,
    The textbox is sourcing its data from a query. The field in the query is providing the current user.

    Regards
    John

  6. #6
    Join Date
    Mar 2004
    Location
    Brighton, UK
    Posts
    5
    I can't see why you'd get a message about the Recordsource if the form was unbound. To make sure the form is unbound, check the RecordSource of the Form and check that the text box control source is empty (displays 'Unbound' in textbox in Design view).

    Also, check that the form's properties such as AllowAdditions and AllowEdits are set to Yes.

    Finally, it would be a good idea to cater for null (blank) values, using something like:

    TmpString = "" & User.Value

  7. #7
    Join Date
    Feb 2004
    Location
    UK
    Posts
    246
    OK, I've take the row source out if the text box so that now is unbound.

    Allow additions and allow eddits are yes.

    Now I'm getting the all kinds of wierd errors, so I had better start form the begining

    The form in question is the main form, it is unbound, but I want to capture on it the current user, but I want this user to be displayed and also to cater for the users sign on being in upper/lower case. So this text field's purpose was to capture the current user and convert it to proper case.
    Perhaps I'm going abou this the wrong way?

    Regards
    John

  8. #8
    Join Date
    Mar 2004
    Location
    Brighton, UK
    Posts
    5
    How does this form know who the current user is? Are the users entering anything in this form to login, or is this done in some other way?

    What you're trying to do sounds fairly straight-froward, but without knowing where this information is coming from, it's hard to advise on the best way to solve the problem.

    Regards

    Tim

  9. #9
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Originally posted by Sticker
    OK, I've take the row source out if the text box so that now is unbound.

    Allow additions and allow eddits are yes.

    Now I'm getting the all kinds of wierd errors, so I had better start form the begining

    The form in question is the main form, it is unbound, but I want to capture on it the current user, but I want this user to be displayed and also to cater for the users sign on being in upper/lower case. So this text field's purpose was to capture the current user and convert it to proper case.
    Perhaps I'm going abou this the wrong way?

    Regards
    John
    John,

    This is what I do: I have a label for the user name in the upper right corner ... I query for the user's name from my internal table using the logon ID and display it ... Simple.

  10. #10
    Join Date
    Feb 2004
    Location
    UK
    Posts
    246
    Hi Tim,
    They are logging in using Access built-in security.

    I have just this moment managed to get around it as follows.

    Bound the form to a query which has field in it called "User". This field is derived as follows
    User: StrConv([CurrentUser],3)
    Then I bound the text box to this output field.

    Probably a long winded way around it but it seems to worl now.

    Thanks for your help

    Regards
    John

  11. #11
    Join Date
    Feb 2004
    Location
    UK
    Posts
    246
    Originally posted by M Owen
    John,

    This is what I do: I have a label for the user name in the upper right corner ... I query for the user's name from my internal table using the logon ID and display it ... Simple.
    Sorry Mike just seen your Reply, will give that a go as well

    Regards
    John

Posting Permissions

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