| View previous topic :: View next topic |
| Author |
Message |
SKP Newbie
Joined: 23 Dec 2003 Posts: 7
|
Posted: Dec 30th, 2003 10:04 AM Post subject: field name as a variable |
|
|
| Is there a way to pass a fieldname as a variable to a procedure? I want to be able to set the focus of a particular field name for different forms based on which command button is being pressed. What would be the declaration type? |
|
| Back to top |
|
Avis Junior Poster

Joined: 07 Oct 2003 Posts: 510 Location: India
|
|
| Back to top |
|
SKP Newbie
Joined: 23 Dec 2003 Posts: 7
|
Posted: Dec 30th, 2003 02:33 PM Post subject: |
|
|
I'm kinda trying to do that already. The problem that I'm having though is that I'm passing the field name that I want to set focus to as a string argument (I'm not sure if that's how I should be passing it). I get an error saying that "Microsoft Access can't find the field 'strcurFld' referred to in your expression" because it doesn't seem to be taking the actual string from it. Here's the line where I get that error:
Me!stcurFld.SetFocus
Maybe you can tell me what I'm doing wrong here? I'm trying to learn this as I go.
Thanks so much! |
|
| Back to top |
|
Andir Centurion

Joined: 21 Dec 2003 Posts: 184 Location: Chicago Area
|
Posted: Jan 1st, 2004 03:47 AM Post subject: |
|
|
The control name is 'strcurFld'? or what is displayed in the field? If your under the thought that just because your control name begins with a 'str' that it's a string, then change the thought process It's just a name.
I might be wrong, but try using a period '.' instead of the exclamation '!' or removing the Me! all together. You shouldnt need to reference a control on the same form by calling the 'Me' object.
You would just use: strcurFld.SetFocus _________________ If you happen to see little people sitting on your desk...don't tell anyone or they might think your crazy too. |
|
| Back to top |
|
|