Basic VBA question

timarndt@core.com

New Member
Joined
May 17, 2003
Messages
14
Okay, I'm pretty good at Excel VBA and am moving slowly into Access projects.

I am confused a little by the object model I would think the following expression would set the variable x to the number of records in an existing table named tblData:

x = tblData.Records.Count

Doesn't work. So my basic question is how do I interact with a table. Does it always have to be through creating a recordset?

Thanks,
Tim.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Yes, use a recordset to work with the data within the table and use a DAO TableDef object or ADOX Table object if you want to work with the table definition i.e. it's structure.
 
Upvote 0
also with Access you need to move to the last record before you do a count as it does not download all of the records in a recordset untill it needs them and this can give a false count.

Peter
 
Upvote 0

Forum statistics

Threads
1,221,569
Messages
6,160,557
Members
451,656
Latest member
SBulinski1975

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top