Results 1 to 13 of 13
  1. #1
    angie is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    232

    Combo Box to auto fill

    Hi I have a combo box with two choices ( Financed and Cash or Check)


    I have two text box one with a cost if financed and one with a cost if payment by cash or check
    I have a field name (total cost) I would like it to auto fill with the choice from the combo box

    If combo box is selected with Financed then the total cost field would show the financed price
    if combo box is selected with cash or check then the total cost field would show the cash price

    Payment type = Financed
    then total cost = financed price
    payment type = cash or check
    then total cost = cash price

    not sure how to write the code.

    Thanks

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Is this what you're looking for?

    http://www.baldyweb.com/Autofill.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    angie is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    232
    I don't think that will work
    I would like to be able to select either financed or cash in the drop down box and if I select financed than that price in the financed field would auto fill the total price field
    I have a field name "financed price" and "Cash price" I have a combo box that I have two items listed "financed price and cash price" depending on which one I select it would show the amount in the field that was selected and have it auto fill the total price.
    I hope that explains it better.
    thanks angie

    Quote Originally Posted by pbaldy View Post
    Is this what you're looking for?

    http://www.baldyweb.com/Autofill.htm

  4. #4
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    839
    Combobox with "Financed";"Cash or Check" default = "Financed"

    Amount: IIF(Combobox="Financed", [Financed_Total], [Cash_or_Check_Total])

    Financed_Total = Whatever the math is, Cash = whatever the input amount is in the control

    This is an overall idea as a starting point

  5. #5
    angie is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    232
    I have tired the following

    if[payment type]=finance then
    [total cost]=finance price

    Elseif [ payment type] = cash or check then
    [total cost] = cash price

    still cant get it to work

  6. #6
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    839
    Is this what you need?

    Cash.zip

    You can add more controls into the Table1 (Generic Named)

    Such as
    Rate
    Loan Amount
    Loan Period
    Down Payment

  7. #7
    angie is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    232
    I am trying to use the code in a event after update.

  8. #8
    angie is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    232
    i tired the following but it still does not work and ideals


    Private Sub Payment_Type_AfterUpdate()
    Payment_Type = Cash_Or_Check
    Me.Total_Cost = Cash_Price
    Payment_Type = Financed
    Me.Total_Cost = Financed_Price

    End Sub

  9. #9
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    839
    Code:
    Private Sub Form_Current()
       DoCmd.GoToRecord , , acNewRec
            Forms!Form1!Money_Type.SetFocus
       Money_Amnt = Null
    End Sub
    
    Private Sub Money_Amnt_AfterUpdate()
       Forms!Form1!Money_Type.SetFocus
    If (Money_Type = "Finance") Then
        Me.Lbl_Type = "Financed"
    Else
        Me.Lbl_Type = "Cash"
    End If
       Me.Type_Amnt = Me.Money_Amnt
           Forms!Form1!OK_Select.SetFocus
    End Sub
    
    Private Sub OK_Select_Click()
         DoCmd.GoToRecord , , acNewRec
    End Sub
    Private Sub OK_Select_Exit(Cancel As Integer)
         Type_Amnt = Null
    End Sub

  10. #10
    angie is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    232
    I have the following on a form
    text box named [financed price] format currency
    text box named [cash price] format currency
    Combo Box named [payment type] which is a value list with two selections (financed) and (cash or check)
    text box named [total cost] format currency
    I would like if the combo box value is "financed" then the data entered in the text box [financed price] will show in the total cost text box
    if the combo box value is "cash or check" then the data entered in the text box [cash price] will show in the total cost text box

  11. #11
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    839
    I had it set up to use 1 unbound text box for the label Finance/Cash and 1 unbound box to show the amount for both. You need deprecated boxes for cash & amount and finance & amount?

  12. #12
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    **I think there are two posts here for the same thing.
    https://www.accessforums.net/showthread.php?t=59320
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  13. #13
    angie is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    232
    this is the code that works
    thanks to everyone

    Private Sub Payment_Type_AfterUpdate()
    If Me.Payment_Type = "financed" Then
    Me.Total_Cost = Nz(Me.Financed_Price, 0)
    Else
    Me.Total_Cost = Nz(Me.Cash_Price, 0)
    End If
    End Sub

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Combo Box to auto fill text box - problem
    By mmaurigi in forum Programming
    Replies: 6
    Last Post: 03-29-2016, 09:35 AM
  2. Auto Fill by Combo Box
    By aamer in forum Access
    Replies: 5
    Last Post: 12-09-2013, 04:27 PM
  3. Replies: 3
    Last Post: 06-09-2013, 05:35 PM
  4. Replies: 5
    Last Post: 11-09-2012, 04:18 PM
  5. Creating a auto fill from a combo box
    By Trina76 in forum Forms
    Replies: 4
    Last Post: 02-07-2012, 02:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums