Results 1 to 6 of 6
  1. #1
    dharanez2036 is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Feb 2020
    Posts
    5

    Populate TextBox based on ComboBox Selection

    Hello,



    I made this OT Calculator in Excel using VBA and trying to do the same thing on MS Access. Need help on how I can get the value on TextBox when I make the selection on ComboBox.

    I have 3 ComboBox. ComboBox1 for Position, ComboBox2 for Step and ComboBox3 for Status. Once I select all 3 values and Click the Calculate Button I want it to give me the value on TextBox (TextBox1 for Base Pay and TextBox2 for OT Rate). This was the code used in excel.

    If ComboBox1.Value = "Accountant" And ComboBox2.Value = "1" And ComboBox3.Value = "Employee" Then
    TextBox1.Text = "$2000.00"
    End If

    If ComboBox1.Value = "Accountant" And ComboBox2.Value = "1" And ComboBox3.Value = "Employee" Then
    TextBox1.Text = "$25"
    End If


    This is not working for MS Access. I have also attached the Form Design. Thank you for help in advance.
    Attached Thumbnails Attached Thumbnails Design123.jpg  

  2. #2
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,372
    "Not working" is of no help. You posted the same code 2x except one is supposed to result in $25 and the other (same code) is supposed to result in $2000.
    Aside from that, there are so many possible reasons for why it "doesn't work" that there's no way for us to know where to begin.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    dharanez2036 is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Feb 2020
    Posts
    5
    Quote Originally Posted by Micron View Post
    "Not working" is of no help. You posted the same code 2x except one is supposed to result in $25 and the other (same code) is supposed to result in $2000.
    Aside from that, there are so many possible reasons for why it "doesn't work" that there's no way for us to know where to begin.
    On second code it's supposed to be TextBox2.Text = "$25" not TextBox1

  4. #4
    dharanez2036 is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Feb 2020
    Posts
    5
    Basically what I am trying to do is when I select the values for 3 ComboBoxes and Click Calculate Hours Button it will populate the Base Pay and OT Rate and do the Calculation. I have attached the Zip Access file. Thank you.
    Attached Files Attached Files

  5. #5
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    Quote Originally Posted by dharanez2036 View Post
    Basically what I am trying to do is when I select the values for 3 ComboBoxes and Click Calculate Hours Button it will populate the Base Pay and OT Rate and do the Calculation. I have attached the Zip Access file. Thank you.
    I notice that your form module does NOT have the following two lines at the very top:
    Code:
    Option Compare Database
    Option Explicit
    They should be the first two lines of every code module.
    Also, Your code makes reference to Textbox4 but you don't have a "Textbox4" on your form.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  6. #6
    dharanez2036 is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Feb 2020
    Posts
    5
    That might be a typo but basically I have 3 TextBoxes... Based on ComboBox values first TextBox is supposed to return Base Pay, second TextBox is supposed to return OT Rate and third TextBox is supposed to do the calculation. My issue is after selecting the values from 3 ComboBox and clicking the Calculate Hours Command Button the values are not populating on two TextBoxes (Base Pay and OT Rate).

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

Similar Threads

  1. Replies: 1
    Last Post: 09-07-2016, 03:17 PM
  2. Replies: 1
    Last Post: 11-14-2014, 07:59 AM
  3. Replies: 3
    Last Post: 11-05-2014, 02:43 AM
  4. Populate a text box based on a combobox selection?
    By Richie27 in forum Programming
    Replies: 4
    Last Post: 04-25-2012, 08:00 AM
  5. Populate a field based on combobox selection
    By rscott7706 in forum Access
    Replies: 5
    Last Post: 06-02-2011, 03:18 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