We help IT Professionals succeed at work.
Get Started

Access 2003: Display a Record/Row number in a query

PriceD
PriceD asked
on
751 Views
Last Modified: 2013-11-29
Hi,

I am attempting to use the instructions from the following past post...
https://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_20492559.html

However its not working for me, what could I be doing wrong?

I copied the posted code and placed it into a module called modGetRowNumber. I have the DAO setup properly as I use it for other procedures. I then opened my query "qrySubFrmTimeSheet" and as per the instructions added a new field that I called RowNum and has the following in it..
RowNum: GetRowNum("qrySubFrmTimeSheet","TimeSheetID",[TimeSheetID])
TimeSheetID is the primary key of the TimeSheet table that I am querying.

When I now run my query "qrySubFrmTimeSheet", I get an error..
Run-Time error '3061':
Too few parameters. Expected 2.

If I click on the Debug button it highlights the following line in the modGetRowNumber module..
"Set rst = CurrentDb.OpenRecordset("SELECT [" & strIDField & "]" & " FROM " & strQueryName, dbOpenSnapshot)"

If I move my mouse over "strIDField" it displays "TimeSheetID". If I move my mouse over "strQueryName" it displays "qrySubFrmTimeSheet". If I move my mouse over "dbOpenSnapshot" it displays "4".

So does anyone have ideas what I'm doing wrong?

Thanks.
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 10 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE