Results 1 to 4 of 4

Thread: Default Value

  1. #1
    Join Date
    Mar 2004
    Location
    Atlanta, GA
    Posts
    58

    Unanswered: Default Value

    Can you place a text field in the Default Value so the value is inserted into the field? For example, I have a text field that I want to populate from the data from a calculated text field in a subform. I put the following into the default value:

    =[INVOICE_SUBFORM]![SubTotal]

    It is not populating the txtField with the data.

    Am I doing something wrong?

  2. #2
    Join Date
    Feb 2004
    Location
    CT,USA
    Posts
    250
    If you want the value in a table I doubt it is possible. If it is on a form or control you would need your formula in the ON OPEN/LOAD sections to code your formula into the section. Need more info of what/where your trying to put the value. Since you don't error out it has no known values to insert into default value. Could you type in a string and test to see if default value works with a string or value?

  3. #3
    Join Date
    Mar 2004
    Location
    Atlanta, GA
    Posts
    58
    Originally posted by poliarci
    If you want the value in a table I doubt it is possible. If it is on a form or control you would need your formula in the ON OPEN/LOAD sections to code your formula into the section. Need more info of what/where your trying to put the value. Since you don't error out it has no known values to insert into default value. Could you type in a string and test to see if default value works with a string or value?
    It would probably be better if I explain what I am doing. I am make a database for a motorcycle shop. I want to copy the DSRP to a text field but I want to be able to edit that value because you know they can change the price according if you are paying cash or financing it. Does that make sense? Say the bike is $3000 and the salesperson say if you pay cash I can let you have it for $2800.

  4. #4
    Join Date
    Feb 2004
    Location
    CT,USA
    Posts
    250
    I assume you already have code to calculate the SubTotal already.
    Try this:

    If paymentType = "cash" then
    [INVOICE_SUBFORM]![SubTotal]=[INVOICE_SUBFORM]![SubTotal]*.93333
    else
    [INVOICE_SUBFORM]![SubTotal]=[INVOICE_SUBFORM]![SubTotal]end if

    In your case 2800/3000 = .93333.

    You could probably put this code in a calculate buttons ON Click code or on the After update section for the paymentType method (perhaps check box here).

Posting Permissions

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