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

  • SEARCH
  • Home
  • 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 8615427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:22:31+00:00 2026-06-12T05:22:31+00:00

I want to write a very simple query and bind it to a listbox

  • 0

I want to write a very simple query and bind it to a listbox with VBA code but an error occures by running this piece of code:

Private Sub Command0_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM funk", dbOpenTable)
Me.List9.Recordset = rs
End Sub

the name of the databse is correct. Could you please inform me how can I solve this problem?

Edit

I’ve changed my code to

Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM funk")
Me.List9.Recordset = rs

but it doesn’t work too

  • 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-06-12T05:22:32+00:00Added an answer on June 12, 2026 at 5:22 am

    There is no need for such complication:

    Private Sub Command0_Click()
    Me.List9.Rowsource = "SELECT * FROM TableName"
    End Sub
    

    However, it would be much better to say:

    Me.List9.Rowsource = "SELECT ID,VisibleField FROM TableName"
    

    You can the hide the ID field yet any selection in a simple select is equal to the ID when the Bound Column is 1.

    You will need:

    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Set db = CurrentDb
    'dbOpenDynaset is the default here, but it would not be the default for 
    'a local table
    Set rs = db.OpenRecordset("SELECT * FROM funk",dbOpenDynaset)
    Set Me.List9.Recordset = rs
    

    Note Set on the last line.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to write a very simple code in Access-VBA. I want to write
I want to write a very simple WYSIWYG editor, but i don't understand how
I'm trying to write a very simple piece of code and can't figure out
I want to write a very simple script , which takes a process name
I'm trying to write a very simple program, I want to print out the
I want write a simple query which will fetch data from a table (which
This is something that should be very simple. I just want to read numbers
I want to write a very simple game in Java to demonstrate a wireless
i am trying to run a very simple java program. i want to write
I just want to write a very simple C++ program for Windows only that

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.