Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jul 2005
    Location
    North Carolina, USA
    Posts
    195
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Hi, By the way, the new looks of the forum ROCKS!!!
    I am having some issue trying to get a strSQL statement result show up in a textbox. I can make the result show in a combobox or listbox rowsource but I want it to show in a textbox automatically.

    strSQL ="SELECT Rate FROM tbloptionscategory WHERE Category = " & Chr(34) & Me.ActualCategory & Chr(34) &""

    If there is another way how to get this done, I will appreciate any advice.

    First I have a table that has two fields "tbloptionscategory"

    Category Value
    Teacher 300
    Supervisor 400

    I have a combobox named "actualCategory" which it rowsource is determine depending on the selection from another combobox named "location"which the user might pick (There is different tbloptions depending the location with different data). When that is executed, a can choose a category from the combobox named "ActualCategory" drop down list. Now, here comes the problem, I would like to get the "value" of the category (in accordance with the strSQL statement) inserted automatic into a textbox named "rate".

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    In your SQL, you have "SELECT Rate ..." but your table appears to have a field Value - which is correct?

    You can use DLookup for this: set the control source of the text box to

    =DLookup("Rate", "tblOptionsCategory", "Category = " & Chr(34) & Me.ActualCategory & Chr(34))

    Replace Rate with Value if that is the name of the relevant field.

  3. #3
    2 Star Lounger
    Join Date
    Jul 2005
    Location
    North Carolina, USA
    Posts
    195
    Thanks
    4
    Thanked 0 Times in 0 Posts
    You're the best. That did the trick. Thank a million!!!

Posting Permissions

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