Results 1 to 8 of 8

Thread: Default Value

  1. #1
    Join Date
    Jun 2012
    Posts
    85

    Unanswered: Default Value

    Hey,
    I have a Start DAte and End Date Txt boxes which are both unbound. I Have a pop up calenedar which fills both values to perform a search. wors great. now im wondering how to have a default value in both. Start Date: 01/01/2000 End Date: Date() .... Now i tried putting it in the text box and it doesnt work. ive also tried using the default value box in the property sheet. Andyone have an idea. thanks
    Mike
    ________

  2. #2
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    Mike,

    The proper place is in the property sheet. Please post exactly what you posted in the PS for that line (default value).

    Sam

  3. #3
    Join Date
    Jun 2012
    Posts
    85
    For Start Date...=01/01/2000
    For End Date.....=Date()

    From looking online though it only shows up on new forms. I dont need that. It is a search form. IE right now i select the dates from the popup calendar and hit search. and the supform returns numbers. I want the default dates to automatically seach so then i can have all data pop up before i select the dates. How would i use the like function with the Between? I have this in my Query... Between [Forms]![Search].[Form]![txtStartDate] And [Forms]![Search].[Form]![txtEndDate] how do i use the like with this? I tried adding in this. Like Between [Forms]![Search].[Form]![txtStartDate] And [Forms]![Search].[Form]![txtEndDate] & "*" (doesnt work)
    Mike
    ________

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Quote Originally Posted by Mike02 View Post

    ...From looking online though it only shows up on new forms. I dont need that. It is a search form.
    A Default Value only shows on new Records, not new Forms! And in essence, with an Unbound Form, you always have a 'New Record.' When you open an Unbound Form the Default Values will appear.

    Quote Originally Posted by Mike02 View Post

    ...I want the default dates to automatically seach so then i can have all data pop up before i select the dates...
    If you want all Records returned when the Form first loads, why not simply run your Query to do just that, when the Form initially opens?

    BTW, you can use simply Date() in the Default Value for today, but to assign a literal date, you have to delimit it like this

    #01/01/2000#

    Sorry, but I'm fuzzy on the last part of your post! Why are you trying to use Between and Like for this?

    Linq ;0)>
    Hope this helps!

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

    All posts/responses based on Access 2003/2007

  5. #5
    Join Date
    Jun 2012
    Posts
    85
    thanks appreciate the help, only reason i was think if i used like with the wild card it would just bring up all recodrs until i search it. that was all! thanks@!
    Mike
    ________

  6. #6
    Join Date
    Sep 2006
    Location
    Surrey, UK
    Posts
    994
    Provided Answers: 2
    I've found that it's easier to assign default values to unbound form controls in the form's Open or Load event. All the expressions are in one place, and you can step through the code to watch what happens in case of errors. For this to work, your form's Open (or Load) event would have the following:
    Code:
    txtStartDate = #01/01/2000#
    txtEndDate = Date()
    Hope this helps!
    10% of magic is knowing something that no-one else does. The rest is misdirection.

  7. #7
    Join Date
    Jun 2012
    Posts
    85
    Thanks for the ID thats great! Appreciate it@!
    Mike
    ________

  8. #8
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Quote Originally Posted by weejas View Post
    I've found that it's easier to assign default values to unbound form controls in the form's Open or Load event. All the expressions are in one place, and you can step through the code to watch what happens in case of errors.
    Actually, I personally do almost everything thru code, for this very reason! It's also one of the main two reasons why I use code instead of the $%^&* Macros Micro$oft insists on trying to force on top of us!

    Glad we could help, Mike!

    Linq ;0)>
    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
  •