Ado ???

ebasta

Registered User.
Local time
Tomorrow, 00:05
Joined
Sep 2, 2004
Messages
33
Hi,

how can I open the current database using ado, without specifying the path?
:eek:
 
Code:
    Dim cn As ADODB.Connection
    Dim rs As ADODB.Recordset
    
    Set cn = CurrentProject.Connection
    Set rs = New ADODB.Recordset

    rs.Open "MyQuery", cn, adOpenStatic, adLockReadOnly

    MsgBox rs.RecordCount
    
    Set rs = Nothing
    Set cn = Nothing
 
THANK YOU! :D

And how can I connect with a query to set some criteria? :o
 
I demonstrated that above too. (i.e. OPEN "MyQuery" ) ;)
 
yes, i can see, but what is the way to change some criteria, to put some sql (taken from 2 differents unbound textcontrols) like: >= text1 and <=text2
:eek:
 
I'd do that in a query and not in this statement.

i.e

NOT

rs.Open "SELECT * FROM MyTable WHERE This = x And That <= y;"


This is slower than having the query predefined and just putting:

rs.Open "Queryname"
 
And what happens if i put in a criteria as
>= forms!FSearch!Text1.value

and the value is null? or worse not enabled?
 
ebasta said:
And what happens if i put in a criteria as
>= forms!FSearch!Text1.value

and the value is null? or worse not enabled?

  • and the value is null? - In the query you can put, as a criteria, the following:

    [Forms]![FSearch]![Text1] OR [Forms]![FSearch]![Text1] Is Null


  • or worse not enabled?

    I don't see what a textbox's Enabled property has to do with anything. If it wasn't enabled and you wanted the .Text property is the only problem I can see.
 
thank you very much!
i'm not an advanced programmer, as you cn see!i only need the good suggestions (sometimes i fell discouraged) :p
 

Users who are viewing this thread

Back
Top Bottom