DAO.Recordset

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi I type those instructions for a command button, I created the recordset
the recordcount tell me that there are 26 records, that is right but I dont
know how to get access to the information, 2 of the fields are AssetTag (key)
and manufacturerID, my question is how can I see the information.

Thanks

Private Sub cmdPrueba_Click()
Dim dbComputers As DAO.Database
Dim rcdAssetTag As DAO.Recordset


Set dbComputers = CurrentDb
Set rcdAssetTag = dbComputers.OpenRecordset("tblComputers", dbOpenTable)

MsgBox rcdAssetTag.RecordCount

If rcdAssetTag.EOF Then
MsgBox " no hay registros"
End If

End Sub
 
Recordsets are not visible. They are for working with the data
programmatically.

To display the data, you could just use this:
DoCmd.OpenTable "tblComputers"

If you have a form, it would be better to use:
DoCmd.OpenForm "Form1"
 
What about if want to find a specific record, I tryed with

rcdAssetTag.FindFirst "AssetTag = """ & Text12 & """"

but I got and error, AssetTag and Text12 are text

rcdAssetTag.MoveNext works ok
 
Hi, for What I saw in your example (The web site) I just can use FindFirst
method if before I apply a RecordsetClone but as soon I do that I start
working with the form recordsource, but let say I want to find a record in
the DAO.recordset not the form Recordsource, should I use a cicle Do While
Not rcdAssetTag.EOF to find the record I want to find?

Thanks
 
Very insteresting that web-page lot of examples, I saw in the example that
the DAO.batabase is substitute by the DBEngine(0)(0), which one is better to
use.
 
Using CurrentDb() flushes all collections, guaranteeing things are up to
date. There is a slight performance penalty while Access does this, so
dbEngine(0)(0) will be fractionally faster.

Using CurrentDb flushes all collections, guaranteeing things are up to date.
There is a slight performance penalty while Access does this, so
dbEngine(0)(0) will be fractionally faster.

CurrentDB:
=======
Advantage: Guarantees everything is up to date.
Disadvantages: Slightly slower
Must be set to Nothing, or resources not released.

dbEngine(0)(0):
==========
Advantages: Slightly faster
Suitable for transactions
Disadvantages: May not be up to date.
May not be the current database.

The last issue can occur after running a wizard or other library database,
or after a compact, or after code that wrongly closes the current workspace.
 
One last question, I set my form to data entry = true because I dont want to
show data when the form is open, but I found the if I want to move data to
the form recordsource, I need to move from the program data entry = false to
allow me move data to the form recordsourse, is this ok or there is another
way to do it.
 
I didn't understand "move data to the form recordsource."

The form automatically saves data to its RecordSource.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top