+ Reply to Thread
Results 1 to 4 of 4

Recordset Query : how to open and retrieve DB

  1. #1
    Registered User
    Join Date
    02-13-2009
    Location
    sg
    MS-Off Ver
    Excel 2007
    Posts
    36

    Recordset Query : how to open and retrieve DB

    I am new to access programming and I am currently having some difficulty with the recordset procedures. I'm not sure if I am doing right in opening the table and getting the data from it.

    Any one can guide me on this so I could get rid of this stumbling block.

    I have 3 combolist and what I am trying to do is when the user selects the 1st combolist, the 2nd combolist should show the list that belongs to that category.

    Since I am not sure the process of connecting to the db, I'm not able to populate the list.

    Appreciate if anyone could help me on this. Thank you


    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    03-20-2008
    Location
    Buffalo, NY USA
    Posts
    43

    Re: Recordset Query : how to open and retrieve DB

    No need to iterate through the record set and build on the fly (although technically you could do it that way). You can simply take your SQL statement and set the combo's row source to it:

    Me.Mycombobox.rowsource = strSQL

    To be on the safe side, I'd then requery the combo box (to make sure the data under indeed refreshed):

    Me.Mycombobox.requery

    Brent

  3. #3
    Registered User
    Join Date
    03-05-2009
    Location
    Vail, Colorado
    MS-Off Ver
    Excel 2010
    Posts
    83

    Arrow Re: Recordset Query : how to open and retrieve DB

    This is one Access form with two buttons and a single combo box
    It creates a record set, uses the record set to populate an Excel worksheet.
    I always use a centralized error tracking function to log errors in a common Access table.

    I left a larger than necessary SQL statement to indicate how complex it can get. Myself, I typically use SQL Server (Access Linked Tables) views, then finish the linkage of several SQL Server Views from here.
    For complex queries, you should also explore Pass-Through queries or other options. For fairly simple queries, this might give you a nice baseline to start.

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    03-05-2009
    Location
    Vail, Colorado
    MS-Off Ver
    Excel 2010
    Posts
    83

    Smile Re: Recordset Query : how to open and retrieve DB

    How to populate a list box in Access (combobox), then use the value chosen from the list to retreive data from a recordset and put it into Excel.
    In this example, I also added two option buttons to choose "buy" or "sell" to make it more interesting.

    The last sub shows how to set the value. Sometimes a recordset returns null for the list box. This code deals with that. Sometimes, the choices on the interface return an empty recordset. This code handles that too.

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1