How to build a SetFocus command (1 Viewer)

ghudson

Registered User.
Local time
Today, 05:33
Joined
Jun 8, 2002
Messages
6,195
How can I build a SetFocus command on the fly? I am creating a Find form where the user can select their options. I am building the listing of options for the user to select from based on which form opened the Find form. All forms are set as Modal and PopUp so I have to set the focus to the form and field to be searched before I call the FindRecord command from the Find form. I am stuck on how to build the SetFocus statement when concatenating the pieces together for the obvious is not working.

This is what normally works.
Code:
Forms![frmClients]![txtStreetAddress1].SetFocus

This is how I am trying to build the statement without success. How can I do this?
Code:
"Forms![frmClients]!" & Me.cboSearchField.Column(1) & ".SetFocus"

BTW:
Code:
Me.cboSearchField.Column(1) = txtStreetAddress1

Thanks in advance for your help!
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 02:33
Joined
Aug 30, 2003
Messages
36,127
Try

Forms![frmClients](Me.cboSearchField.Column(1)).SetFocus
 

ghudson

Registered User.
Local time
Today, 05:33
Joined
Jun 8, 2002
Messages
6,195
Yes that works! Thank you Paul!!!
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 02:33
Joined
Aug 30, 2003
Messages
36,127
Happy to help!
 

Users who are viewing this thread

Top Bottom