Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old July 20th, 2004, 05:11 PM
cus129 cus129 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 20 cus129 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 39 m 18 sec
Reputation Power: 0
Unhappy Please help:Select query problem

Hello,

I code in VBA and I am trying to execute a "select" query but it gives me all sorts of error.

Here is the code:

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Set db = CurrentDb

strSQL = "SELECT Sponsor FROM tblActivity WHERE tblActivity.NameoftheActivity = '" & Camping & "'"
Set rs = db.OpenRecordset(strSQL)

rs.Close
db.Close

Please tell me what is wrong.
Any help will be extremely appreciated.

Reply With Quote
  #2  
Old July 21st, 2004, 03:03 AM
Paula Paula is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 65 Paula User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 37 m 32 sec
Reputation Power: 5
What errors do you get?


Do you have the right reference libraries? Go to View - Object Browser in your VBA session and type in the keywords database and recordset. Check which libraries they are in and then go to Tools - References and check you have those libraries selected. I've had similar problems myself with this.

Reply With Quote
  #3  
Old July 21st, 2004, 03:02 PM
cus129 cus129 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 20 cus129 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 39 m 18 sec
Reputation Power: 0
Just cant get it to work

I am still getting error :
Too few parameters. Expected 1.

I have checked the libraries and they are right....

I have tried all possible ways of editing the select query looking at the web...but no luck.

I am sure that it is something to do with the syntax of the select query.
Anyone with any ideas?

thanks

Reply With Quote
  #4  
Old July 21st, 2004, 07:32 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 19 h 31 m 41 sec
Reputation Power: 180
Often this error is caused by a misspelled column name in your sql string.
__________________
======
Doug G
======
I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Reply With Quote
  #5  
Old July 29th, 2004, 03:27 AM
webexpert webexpert is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 2 webexpert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
What is your database engine?

Please specify what is your database engine?

I think you have to try for first these queries directly on database (Query Analyzer)...
if this is fine then this works on your app to...

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Please help:Select query problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway