Advertisement

07.14.2008 at 08:04AM PDT, ID: 23562834
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.9

Very simple question on how to do an SQL Select statement in vba

Asked by jondecker76 in SQL Query Syntax, Access Coding/Macros

Tags: , ,

I am a fairly experienced PHP / mysql programmer, but I'm having problems doing a very simple query in Microsft Access 2003 using VBA.

All I want to do is check to see if a field exists in a table.
Right now, the code is:

Dim db As DAO.Database
    Dim qd As DAO.QueryDef
    Dim rs As DAO.Recordset
    Dim strSQL As String
    Dim varResult As Variant
   
    Set db = CurrentDb()
   
    'Lets validate and check for duplicate data...
    Set rs = db.OpenRecordset("SELECT * FROM Point WHERE Point.Tagname = '" & Me.txtTagName & "';")



but now, no matter what ever I do with rs, i get an error. Now that I have the result set in rs, how do I tell if there were actually any results returned so I can see if this is duplicate data before doing an insert query.

I've tried rs.RecordCount() but it always seems to return a value

I need to evaluate whether or not there were any records matching my select queryStart Free Trial
[+][-]07.14.2008 at 08:19AM PDT, ID: 21998842

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: SQL Query Syntax, Access Coding/Macros
Tags: Microsoft, Access, 2003
Sign Up Now!
Solution Provided By: capricorn1
Participating Experts: 2
Solution Grade: A
 
 
[+][-]07.14.2008 at 08:24AM PDT, ID: 21998901

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628