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 119599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:40:43+00:00 2026-05-11T03:40:43+00:00

This is basic stuff, but I’m somewhat unfamiliar with VBA and the Word/Access object

  • 0

This is basic stuff, but I’m somewhat unfamiliar with VBA and the Word/Access object models.

I have a two column database of about 117000 records. The columns are ‘surname’ and ‘count’. I want a user to be able to type SMITH in a textbox and hit submit. I then want to run something like

SELECT table.count FROM table WHERE surname = string

and return the value of table.count in a string.

It feels like this should be five or six lines of code (which I have but won’t post) but I’m obviously missing something!

Cheers

  • 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. 2026-05-11T03:40:43+00:00Added an answer on May 11, 2026 at 3:40 am

    First of all, be careful naming the column ‘count’ — this is a keyword in SQL and might cause problems. Similarly, don’t call the table ‘table’.

    Here is some sample code which shows one way of doing it:

    ' This example uses Microsoft ActiveX Data Objects 2.8, ' which you have to check in Tools | References  ' Create the connection. This connection may be reused for other queries. ' Use connectionstrings.com to get the syntax to connect to your database: Dim conn As New ADODB.Connection conn.Open 'Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\tmp\Database1.accdb'  Dim cmd As New ADODB.Command Set cmd.ActiveConnection = conn  ' Replace anything which might change in the following SQL string with ?  cmd.CommandText = 'select ct from tbl where surname = ?'  ' Create one parameter for every ?  Dim param As ADODB.Parameter Set param = cmd.CreateParameter('surname', adBSTR, adParamInput, , TextBox1.Text) cmd.Parameters.Append param  Dim rs As ADODB.Recordset Set rs = cmd.Execute  MsgBox rs('ct')  rs.Close conn.Close 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 138k
  • Answers 138k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You could do something like: $('<div></div>').appendTo("#id_name").hide().append(html).fadeIn('slow'); May 12, 2026 at 7:31 am
  • Editorial Team
    Editorial Team added an answer Even if each page you cache is only 5kb, that… May 12, 2026 at 7:31 am
  • Editorial Team
    Editorial Team added an answer Works perfectly for me with your route. Try this simple… May 12, 2026 at 7:31 am

Related Questions

This is basic stuff, but I'm somewhat unfamiliar with VBA and the Word/Access object
What good tools can I use to monitor IIS. What is included seems to
Hi this is pretty basic jQuery stuff but i am a little lost. So
This is very basic stuff , but here goes. I find that I am
So, this is problem a stupid mistake, but I've been hacking away at it

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.