By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,098 Members | 2,007 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,098 IT Pros & Developers. It's quick & easy.

Problem Calling Public Procedure

P: 3
I'm an old PowerBuilder developer that is new to Access development, and I'm stumbling on getting the rownum function to work. I've added the "rownum" public function to an existing module within my application, and I've added a textbox called "rownum" to my form with the controlsource you suggested. When I run my form, I get "#Error" displayed in the rownum textbox in each row of the form. Any idea what I might be doing wrong?

Thanks,
Jeff
Jul 17 '07 #1
Share this Question
Share on Google+
6 Replies


NeoPa
Expert Mod 15k+
P: 31,494
I'm splitting this question into a thread of its own. It refers back to the Row numbers and alternate colors to a Continuous Form - simple and almost works article.

MODERATOR.
Jul 17 '07 #2

NeoPa
Expert Mod 15k+
P: 31,494
If you have defined a TextBox named [RowNum] as well as a Public Function named [RowNum], then Access will think you are trying to access the TextBox rather than the Public Function. Try a more conventional name (like [txtRowNum]) for your TextBox instead.
Jul 17 '07 #3

P: 3
Unfortunately, I had tried changing the name of the textbox before, and still got the "#Error" displayed when I ran the form. Another thing I did was to put a debug breakpoint in the public "rownum" function, and it never triggered. I had copied the function declaration right out of the posting and into a module, so I'm not sure what I could've done wrong there. As a test, I created a new form from scratch, added a textbox in the detail band with the "=rownum(Forms!myform)" as Control Source, and still got the error. Any other ideas?

Thanks!

Jeff
Jul 17 '07 #4

NeoPa
Expert Mod 15k+
P: 31,494
What's the name and type of the module that it's defined in?
For good measure, can you post the relevant parts of the code here (The function definition and any public variables / constants it uses).

... & this may seem a silly question, but is your open form called [MyForm]?
Jul 17 '07 #5

P: 3
Eureka! Your "silly" question tied directly to my silly mistake of leaving "myform" in the control source of the text box. Once I specified the form correctly, and the function works and I have row numbers. I guess I still have a ways to go before I can call myself an Access developer... Thanks so much for your help!

Jeff
Jul 17 '07 #6

NeoPa
Expert Mod 15k+
P: 31,494
No problem Jeff.
Experience is just seeing all the little mistakes so many times. It's certainly not uncommon.
I'm pleased you got it sorted anyway :)
Jul 18 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.