Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    May 2001
    Location
    Oxfordshire
    Posts
    456
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Text box value (2003 SP2)

    I'd like to have a default value in a text bos, that equals the maximum date of a table field +1.

    I've tried a few options, but I still end up with #Name in the box.

    What am I doing wrong?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Text box value (2003 SP2)

    Is this default value going to change as the user moves from record to record, or will it remain static while the form is open?

  3. #3
    4 Star Lounger
    Join Date
    May 2001
    Location
    Oxfordshire
    Posts
    456
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Text box value (2003 SP2)

    It could change. I'm using it as a query criteria, so users could possibly run the query more than once.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Text box value (2003 SP2)

    You can use code in the On Current event of the form, so that the default value will be updated as the user moves from record to record:

    Private Sub Form_Current()
    Me.txtSomething.DefaultValue = Chr(34) & (DMax("DateField", "tblSomething") + 1) & Chr(34)
    End Sub

    Substitute the appropriate names.

  5. #5
    4 Star Lounger
    Join Date
    May 2001
    Location
    Oxfordshire
    Posts
    456
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Text box value (2003 SP2)

    That's done it.

    Thanks

Posting Permissions

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