Results 1 to 4 of 4

Thread: Auto#

  1. #1
    Join Date
    Sep 2003
    Location
    Raleigh, NC
    Posts
    183

    Wink Unanswered: Auto#

    I Auto# field on my form. Now when uers see the form they see "AutoNumber" in txt field.

    Is there anyway to show that text box blank but still keep the same datatype "Auto#"
    Skharva

  2. #2
    Join Date
    Feb 2004
    Location
    Wales
    Posts
    343
    mmmmmm
    nice question - Id like to see the replies to that one - tis one of those interesting "havn't done that yet ones"


    regards

    gareth

  3. #3
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,424
    Provided Answers: 8
    can't you use the

    Me.NewRecord

    if it is true hide the ID feild and show the Auto#

    and run it in the Current() Event

    code something like

    Code:
    Private Sub Form_Current()
    
         If Me.NewRecord Then
            Me.Auto.Visible = True
            Me.ID.Visible = False
         Else
           Me.Auto.Visible = False
           Me.ID.Visible = True
         End If
    End Sub
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

  4. #4
    Join Date
    Nov 2003
    Posts
    1,487
    Just off the top...you could try this:

    It involves one additional TextBox control and a little display manipulation via code but it does the trick.

    - Copy and paste your Autonumber Textbox control on form. Call the new TextBox control "AutoCover".

    - Provide the exact Left and Top properties to the new control so that it will cover up the original control.

    - Set the Locked property for the AutoCover TextBox to Yes.

    - Make sure focus is on the new Textbox Control (in design view) and from the Access Format menu, click Bring To Front.

    - Set the Key Preview property for your Form to Yes.

    - Now, in your Form's On Open event, enter code similar to what is shown below:
    Code:
    Me.myFormsFirstDataEntryFieldName.SetFocus 'not the autonumber field.
    - In your Form's On Key Down event, enter code similar to what is shown below:
    Code:
    If Not IsNull(Me.myFormsAutoNumberFieldName) Then
       Me.AutoCover.Visible = False
    Else
       Me.AutoCover.Visible = True
    End If
    This may all appear complicated but really, it isn't.


Posting Permissions

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