controlsource property

G

Guest

I am an Access developer in Access 2002.
A simple code below in my form_load code is not running.
I've debug the code and it walks thru with no problem but when
I open the form, the control source is not pointing to the field I've
directed it too.


Private Sub Form_Load()
Dim strLevel as string
strLevel = "VP"


Select Case pubTitle
Case "DOS"
Me.Txt_Lock.ControlSource = "Field1"
Case "VP"
Me.Txt_Lock.ControlSource = "Field2"

End Select

End Sub

thank you.
 
R

Rick Brandt

Bret said:
I am an Access developer in Access 2002.
A simple code below in my form_load code is not running.
I've debug the code and it walks thru with no problem but when
I open the form, the control source is not pointing to the field I've
directed it too.


Private Sub Form_Load()
Dim strLevel as string
strLevel = "VP"


Select Case pubTitle
Case "DOS"
Me.Txt_Lock.ControlSource = "Field1"
Case "VP"
Me.Txt_Lock.ControlSource = "Field2"

End Select

End Sub

thank you.

It would be safer to have two different TextBoxes each bound to one field and
then make one visible and the other not visible instead of trying to change the
ControlSource.
 
P

PC Datasheet

If pubTitle does not vae a value of DOS or VP neither Case statement will
execute. You might consider adding a default value of DOS ot VP to pubTitle
or adding a Case Else statement to your Select Case procedure.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com

If you can't get the help you need in the newsgroup, I can help you for a
very reasonable fee. Over 1000 Access users have come to me for help.
Need a month calendar or 7 day calendar? Need appointment scheduling? Need
room reservations scheduling? Need employee work scheduling? Contact me!
 
S

StopThisAdvertising

PC Datasheet said:
If you can't get the help you need in the newsgroup, I can help you for a
very reasonable fee. Over 1000 Access users have come to me for help.

These 1000 (if at all a real figure..) is only the result of
-- 4 years abusing the newsgroups.
-- 4 years blatantly advertising and job hunting.

You only care about making money, and you act as if the groups are your private hunting ground.
So why would ANYBODY ever trust a person like you and hire you?
********************************************************
Need a month calendar or 7 day calendar? Need appointment scheduling? Need
room reservations scheduling? Need employee work scheduling? Contact me!

Need a psychiatrist ...Contact me!

Arno R
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top