Novice in Need of Serious HELP!!!

  • Thread starter Thread starter mackjoe
  • Start date Start date
M

mackjoe

Guest
I am trying to count the rows in a couple of tables in Access. I am then going to use these numbers to set up a nested loop through to go through Table A row-by-row, a total of X times, where X is the number of rows in Table B, and compare data in a certain field (string) in Table A with that stored in a variable in Table B, and populate an integer field in Table A based on the similarity/difference.

I have it set up as an OnClick event. Does anyone know how I can count the rows of the tables (hypothetically named "tblChannel" and "tblProduct"), and then parse through a tblProduct row by row? Can you parse through an Access table like an array (If tblProduct(i).Channel = strChannel Then ), where i is the row number?

I have programming experience (C, Java), but not in VB.

Any assistance would be greatly appreciated...
 
Have you tried using the seek command? If I understand what you are trying to do correctly it sounds like the seek command may help you tremendously. Let me know if that helps
good luck
John
 
Hi
To count tables in Access
Create a VBA recordset named ie X for a table then
X.Movelast
variable = X.RecordCount

Note : Should you wish to count both of yr tables together:
create a Union Query in Access with both tables included, then
Create a VBA recordset on that query = X
X.Movelast
variable = X.RecordCount

Once youve got yr Recordset/s established you can Loop thru records by using
X.MoveFirst
Do Until.X.EOF
do stuff
X.MoveNext
Loop

If you dont know how to create a recordset in VBA please Email or see Access help on subj.
 

Users who are viewing this thread

Back
Top Bottom