Results 1 to 4 of 4
  1. #1
    Join Date
    May 2009
    Posts
    104

    Unanswered: Default Form Values

    I have a form that i'm using to enter in purchase order information. I want every record to have the same purchase order as the previous. If someone wants to change the purchase order number they can just change it and then every record following will repeat that purchase order number. I have tried to do this multiple ways but not really getting the result i wanted. I can create a combo box and use that but not sure how to make that default to last used PO number.

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6

  3. #3
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    I just use the AfterUpdate event for each of the fields and add this code to the values I want to repeat:

    me.MyFieldName.DefaultValue = "=" & me!MyFieldName
    or
    me.MyFieldName.DefaultValue = "= '" & me!MyFieldName & "'"

    I can't recall which syntax works.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Code:
    Private Sub YourControlName_AfterUpdate()
       Me.YourControlName.DefaultValue = """" & Me.YourControlName.Value & """"
    End Sub
    This will work for Text, Numbers and Date/Time fields.
    Hope this helps!

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

    All posts/responses based on Access 2003/2007

Posting Permissions

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