Results 1 to 8 of 8

Thread: default value

  1. #1
    Join Date
    Mar 2004
    Posts
    16

    Unanswered: default value

    Hello,

    I have a simple question. How could I set maximum or minimum value of a field of a table as a default value in a text field ?
    I would like to use something like:

    =Minimum([name_of_table]![date_field])

    which would be written in a text field as a default value. It doesn't work.

    Thanks for any help,
    Greetings,
    Pawel

  2. #2
    Join Date
    Nov 2003
    Location
    Europe
    Posts
    369
    make a function that fetches the value with a select statement :

    strSQL = "(select... )"

    , then set the default value of the text box to

    =yourfunctionname

    Daniel.

  3. #3
    Join Date
    Mar 2004
    Posts
    16
    I'm not sure if i caught you properly but now I have a query called date_minimum and it looks like:

    SELECT Min(wplaty.date) AS date
    FROM wplaty;

    The query works perfectly but when I set the default value of my text field like '=[date_minimum]' it says that there is some problem with the name.


    Pawel

  4. #4
    Join Date
    Apr 2004
    Location
    South Arica
    Posts
    125
    You are trying to get the text box to look at the query, not a record in the query.

    =[date_minimum]![date]

    This should work

  5. #5
    Join Date
    Apr 2004
    Location
    South Arica
    Posts
    125
    as long as "date_minimum" is the name of the query, and "date" is the name of the field.

  6. #6
    Join Date
    Mar 2004
    Posts
    16
    unfortunately it doesn't work...

    Maybe someone has any other ideas?

    Thanks,
    Pawel

  7. #7
    Join Date
    Apr 2004
    Location
    South Arica
    Posts
    125
    Right click on your text box, goto properties. On the data tab, select the controlsource property, and click on the three dots(...). In the window that comes up, selct queries from the left pane, then select your query. The fields are shown in the right pane. Double click the field you would like displayed.

  8. #8
    Join Date
    Sep 2001
    Location
    Chicago, Illinois, USA
    Posts
    601
    Common people, this is Access, not VB ! ! !

    in the DefaultValue property, just enter the following:

    =DMin("[date_field]","name_of_table")

    That's it.
    Ken

    Maverick Software Design

    (847) 864-3600 x2

Posting Permissions

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