Results 1 to 2 of 2
  1. #1
    Kennedy731 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Location
    Illinois
    Posts
    1

    Access 2010 - Pulling the TOP/max number of records user prompted for value

    I would like a user to specify the total number of records they need from a query result. The result must be random, therefore cannot filter on any field or data in the table.
    On a form, the user enters the total # of records they need and selects a button that executes this:

    DoCmd.RunSQL.SELECT DcountRDP.RDP_IND, DcountRDP.GRP_ST_CD, DcountRDP.AUDIT_STATUS, DcountRDP.AUDIT_TYPE, DcountRDP.AUD_ID, DcountRDP.ACURT_IND, DcountRDP.AUD_DT
    FROM DcountRDP
    WHERE DcountRDP.MaxRecords = [Forms]![Open_Frm]![IL]



    This is not working at all.

    How can I make it possible for the user to enter a total needed or be prompted to enter a total and then randomly produce the first top # of records that they specify?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,633
    Doesn't work partly because can't 'run' a SELECT query, only action queries (UPDATE, INSERT, DELETE, etc).

    SELECT queries in VBA are to open a recordset. Open a recordset to programmatically manipulate data.

    What do you want to do with the data?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 13
    Last Post: 11-18-2013, 02:20 PM
  2. User permissions - access 2010
    By Outlook in forum Security
    Replies: 3
    Last Post: 12-03-2012, 08:19 AM
  3. Expression Help - Pulling a number from a text box.
    By MintChipMadness in forum Access
    Replies: 6
    Last Post: 08-08-2012, 02:11 PM
  4. Replies: 2
    Last Post: 04-13-2011, 09:42 AM
  5. Replies: 1
    Last Post: 08-22-2010, 12:25 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