Results 1 to 14 of 14
  1. #1
    amangupts is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2011
    Posts
    43

    Combo box not picking up values basis dlookup

    Hi,
    I have created a combo box and trying to use dlookup to populate values in it. There is a column in the query where certain values are defined as A for available, and U for unavailable. I want combox to highlight data related to A only. Is it possible to use dlookup for such a situation or there is any other way by which I can achieve this.
    Any information would be of great help.



    Thanks in Advance.
    Aman

  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,521
    I'm not clear on how you're trying to use DLookup. Typically you would use the rowsource query of the combo:

    SELECT...
    FROM...
    WHERE FieldName = "A"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    amangupts is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2011
    Posts
    43
    Hi,
    Thanks for ur reply. I tried using row source. I have a query nmed SHQL which contains list of holidays. Against each holiday, day and date r mentioned with status as available or unavailable. Can you please help me in writing the Select criteria as I tried dng it but could not achieve the desired result.
    Thnks a lot.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Can you post the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    BobC is offline Novice
    Windows Vista Access 2007
    Join Date
    Jul 2011
    Posts
    4
    If you are finding SQL difficult just just click in the combo when in design mode, select properties, ensure the 'row source type' is set up query/table then click the builder button ... on the right of the row source property. This will open the query builder. Build your to produce the results you want and when you close the builder Access will write the SQL for you.

  6. #6
    amangupts is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2011
    Posts
    43
    Hi,
    Thanks for your replies. Actually whenever i click on query builder it opens up the query in design mode. Any solution to this?

    Thanks
    Aman

  7. #7
    amangupts is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2011
    Posts
    43
    Hi,

    This is what I have been able to enter Rowsource Query.

    SELECT [SHQL].[Holiday], [SHQL].[HolDate], [SHQL].[HolidayDay] FROM SHQL WHERE SHQL.Status=“A” ORDER BY [HolDate];

    Its still not working. Whenever I go back to the form, it asks for a parameter value and when I enter A it shows what I want, but I want that combox should automatically display holidays with A status only.

    Is there a way to solve this issue? Here SHQL is a query and all other are columns in the query.

    Any information would be of great help.

    Thanks

    Aman

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    The parameter prompt means Access can't find something. Double check the spelling of all your field names (and make sure the other query opens without the prompt). I take it you can't post the db?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    amangupts is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2011
    Posts
    43
    Hi,

    Thanks for ur reply. I will post database by tommorow.

    Aman

  10. #10
    amangupts is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2011
    Posts
    43
    Hi,

    I tried to upload the database today, but there is some problem with it. Some of information is not getting displayed in the database. I am trying to resolve that issue. In the meanwhile, I was trying to do something in a form in another database. Please let me know if it can be done. Below is a sequence of events that is taking place:

    1) User Clicks on a Holiday in a Combobox. (Done)
    2) A Textbox indicates whether it is available or not. (Done)
    3) If it is available, a checkbox is enabled for user to select. (Done)
    4) If user selects the checkbox, a message box comes, "Do you wish to Apply for Selected Leave" with Yes and No Options . (Done)
    5) If user selects, "Yes", than a message box comes, "Your leave is pending for approval".

    I have created a table to maintain information for leaves applied for and approved with Yes/No. Here I am facing a problem. I want the table fields to automatically get populated based on Step 4.
    Even though steps 1-5 are functioning properly, this is one area where I am unable to link this function.

    I would be really thankful if you can provide any sort of guidance on this matter.

    Aman

  11. #11
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Shouldn't be too difficult. The simplest way would probably be to create an append query that got values from the form. You can then execute it with

    DoCmd.OpenQuery
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  12. #12
    amangupts is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2011
    Posts
    43
    Hi,

    Thanks for your reply. It would be great if you can help me with brief steps involved in the process.


    Aman

  13. #13
    amangupts is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2011
    Posts
    43
    Hi,

    I used what you told me to do on a different database as my regular one is not working. Some problem with it. It worked great. Thanks a lot for your help.

    Aman

  14. #14
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help Aman.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 4
    Last Post: 06-02-2011, 02:32 PM
  2. Me not picking up new columns in table
    By asterismw in forum Programming
    Replies: 3
    Last Post: 03-11-2011, 02:00 PM
  3. Obtain the MAX values on a monthly basis
    By rajmns in forum Queries
    Replies: 1
    Last Post: 12-14-2010, 02:32 PM
  4. Replies: 1
    Last Post: 03-27-2010, 06:13 AM
  5. How do I get dlookup values to store in table
    By rpmyhero in forum Access
    Replies: 1
    Last Post: 11-25-2009, 05:57 AM

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