SQL Query in .ADP

  • Thread starter Thread starter phil1bruening
  • Start date Start date
P

phil1bruening

Hi,

how can i make a simple Select Query with VB in Access (.adp)?


Thanx a lot
 
The format is the same as you would use if you were working with an Access
..mdb file:

SELECT field_name1, field_name2 FROM table_name;

You can add criteria:
SELECT field_name1, field_name2 FROM table_name WHERE field_name1 = 3;


I'm not sure if this was the information you needed. If you need more
specific information about working with recordsets in ADO, you would need to:

DIM rec as new adodb.recordset
DIM strSQL as string

strSQL = "SELECT field_name1, field_name2 FROM table_name;"
rec.open strSQL, currentproject.connection, adOpenKeySet, adLockOptimistic

ADO recordsets work a bit differnently than DAO so you can poke around on
the Microsoft Developer Network where there are many articles you can search
through for information:
http://msdn.microsoft.com/default.aspx

If you are used to working with .mdb files the link below gives a brief
translation from DAO to ADO for some things. (Though it doesn't cover how
some of the record navigation works differently too.
http://msdn.microsoft.com/library/d...-us/vbaac11/html/achowDAOToADO_HV05267115.asp

Hope that helps.
 
One other tip is that you can let Access help you with the syntax fot a
SELECT statement. Just build a query, stored proceedure, or a view with the
wizard and then switch it to SQL view. Copy and paste the code.
 
Back
Top