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

Lookup Fields and Forms - how do I control the combo box?

P: 24
I have a standard two-table structure, Orders which has a lookup field to the Salesperson table. However when you build a form the salesperson field has the combo box feature - which I WANT when adding new orders BUT NOT when viewing existing orders (because you can actually change the salesperson by using it) - I am guessing I must use code (have no idea what code) and add it to a from so I can have a View orders form (which now displays salesperson as a locked text field) and an ADD orders form which the code is not attached to and therefore allows the user to choose the salesperson using the combo box.
Any thoughts?
Feb 13 '07 #1
Share this Question
Share on Google+
2 Replies


Rabbit
Expert Mod 10K+
P: 12,315
You can lock a field in code by using:
Expand|Select|Wrap|Line Numbers
  1. Me.ControlName.Locked = True
Feb 13 '07 #2

NeoPa
Expert Mod 15k+
P: 31,186
Try an On Current procedure for your form :
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2.   Me!Control.Locked = (Not IsNull(Me!Control))
  3. End Sub
This will lock a field when it is selected and it has existing data, but unlock it if the field is empty.
Feb 14 '07 #3

Post your reply

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