Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7195489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:35:22+00:00 2026-05-28T20:35:22+00:00

I have a Recordset obtained by the following query: SELECT DISTINCT [Number] FROM NUMBERS

  • 0

I have a Recordset obtained by the following query:

SELECT DISTINCT [Number] FROM NUMBERS WHERE CODE = 7 ORDER BY [Number]

The Recordset will therefore be a list of ordered numbers, eg. [6,14,37,59,81,145]

I would like to generate a long string of numbers made up of only 0s and 1s, where it is all 0s except in positions designated by the numbers in the recordset: eg. 6,14,37,59, etc.

The result would therefore look something like:

000000000000000000100000000000000000000001000000000000000000001000000 etc

Assuming that rs is the Recordset, I have the following code so far. Would this work?

intLower = 1
While Not (rs.BOF Or rs.EOF)
    intUpper = rs!Number
    For intSlot = intLower To intUpper
        strOutput = strOutput & IIf(rs!Number = intSlot, 1, 0)
    Next intSlot
    rs.moveNext
    intLower = intUpper + 1
Wend

Note: I realise this is similar to an earlier question of mine, but I am now asking how to do this when the numbers are contained in a Recordset. Also note that I do not want to use a function that converts a recordset to an array, because I am using DAO and apparently the GetRows is problematic.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T20:35:22+00:00Added an answer on May 28, 2026 at 8:35 pm

    How about;

    dim value as long
    dim result as String
    
    do while not rs.EOF
        value = rs!Number
        If (value > Len(result)) then result = result & String$(value - Len(result), "0")
        Mid$(result, value, 1) = "1"
        rs.moveNext
    loop
    msgbox result
    

    Edit as they are sorted;

    dim result as String
    
    do while not rs.EOF
      result = result & String$(rs!Number - Len(result) - 1, "0") & "1"
      rs.moveNext
    loop
    msgbox result
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a combobox in Access 2003 whose recordset is obtained from a stored
I have a text field who's value is populated from a SQL recordset (below).
EDIT: See end of my post for working code, obtained from zeekay here .
I Have recordset rc1 that reads values from txt file. The fields are rtn
Okay I have a queswtion about returning the recordset from multiple stored procedures. If
I have a table which the rows are loaded dynamically from a recordset. I
I have a following XML structure that I need to transform: <recordset rowCount=68 fieldNames=ITEM,ECL,LEAD_TIME
I have two form. One will display records form a RecordSet that the other
I need to render a unordered list with the data obtained from database using
I have code similar to Dim A, B, C Set rs = Server.CreateObject(ADODB.Recordset) strSql

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.