Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2005
    Posts
    4

    Question Unanswered: Form default value from a record in a table

    Hi, I would like to define the default value of a form text box from a record in a table.
    I tried to tyoe in the following in the default value box of my form's text box:
    = SELECT [Table1]![field_for_default_value] FROM [Table1] WHERE ((([Table1]![2nd_field])='whatever'));

    It did not work... Hence this post.
    Can you help?

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    have a good look at the help system regarding how you construct SQL statements

    if 2nd_field is numeric
    strSQL= "SELECT field_for_default_value FROM Table1 WHERE 2nd_field=blah;"

    if 2nd_field is non numeric
    strSQL= "SELECT field_for_default_value FROM Table1 WHERE 2nd_field=" & chr$(34) & "blah" & chr$(34) & ";"

  3. #3
    Join Date
    Jun 2003
    Location
    USA
    Posts
    1,032
    Hi, I would like to define the default value of a form text box from a record in a table.
    Instead of:

    = SELECT...

    Perhaps use Access Help to look into using:

    = DLookup(...)
    J. Paul Schmidt, Freelance Web and Database Developer
    www.Bullschmidt.com
    Access Database Sample, Web Database Sample, ASP Design Tips

Posting Permissions

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