Recordset Tutorial

  • Thread starter Thread starter Patrick
  • Start date Start date
P

Patrick

Hi all,

I have been searching high and low for some basic tutorials for
recordsets. Does anyone know where I can find any?

I come from a web based (php) background, and find it quite easy to
interact with such a database (mysql). I guess i am looking for
something just as clear that will help me to interact as best possible
with an access database now that i am working on desktop stuff.

Thanks

Patrick
 
A recordset can be either a table or a query - simple as that.

If you are using VBA, then you must first establish object variables to work
with.
All recordsets use the same basic form. First you have to establish a
reference to a database object:
Dim dbf As Database
Set dbf = CurrentDb - Establishes a reference to the current database.
You can open a recordset in another mdf. You just have to identify it.

Next, a reference to a recordset object:
Dim rst as Recorset
Set rst = dbf.OpenRecordset("SomeTableOrQueryName", <options.)

If you want to use SQL you have written into the code, for example, where
the query will change based on user options, then you can use this technique:

Dim strSQL as String
Dim dbf as Database
Dim rst as Recordset
strSQL = "SELECT * FROM SomeTable WHERE SomeTable.Some Field = 0;"
Set dbf = CurrentDb
Set rst = dbf.OpenRecordset(strSQL, <options>)

If you are familiar with SQL, then 75% of the battle is won.
Hope the above snipet will do you some good. Post back if you have questions.
To use a table as a recordset:
 
hey thanks so much! i was just expecting a link. but that has given me
the push start i needed, and i am away again! thanks for that.

Patrick
 
someone has suggested that what i needed to add to my code was something akin
to

CurrentDb.Recordset.FindFirst "PKFieldName = " & VariableName

when i enter CurrentDb in my AfterUpdate event property i find that when i
type in the dot (".") that "Recordsets" and NOT "Recordset" is available from
the dropdown list.

can anyone explain what's going on with that -- and yes, i am a newbie.
 
i think i knoiw about as much about recordsets as you sorry.... hope
someone is able to help soon..
 
Back
Top