Linking Combo Box & Textbox

Ok boys. That was very clear, and now works like a charm. The only problem I had with your code is that the .Column(1) portion produced a syntax error, but without that it works perfect.

I don't find the concepts of vb code and access complicated; however, knowing the code commands and syntax is a bit frustrating for me. That's why it's much easier to ask on the forum, because then I see a specific use for specific code.

While we are on the subject of these combo boxes, I have another question. When a user enters something in the ServiceID or ProductID boxes, I would like to lock the other box. As you can see in the picture, there is a ServiceID and ProductID column for every row, but only one can be entered per row, for purposes of data entry. So if someone enters a serviceID, I would like the ProductID box to automatically lock on update and vice versa. Also, if they make an error, and intended to enter a product instead of a service, clearing the box would unlock the other box. Does that make sense?

Thanks for your detailed responses. A big help, really.
 
When a user enters something in the ServiceID or ProductID boxes, I would like to lock the other box. As you can see in the picture, there is a ServiceID and ProductID column for every row, but only one can be entered per row, for purposes of data entry. So if someone enters a serviceID, I would like the ProductID box to automatically lock on update and vice versa. Also, if they make an error, and intended to enter a product instead of a service, clearing the box would unlock the other box.
For something like this, I always use buttons. I have many search forms that contain numerous criteria dropdowns. What I would do for something like this is write a "lock" syntax line for each combo box with its update event, then a button to clear all the data, in case they screw up. Like...
Code:
Combo1 After_Update

  me.combo2.locked = true
And like...
Code:
Combo2 After_Update

  me.combo1.locked = true
and then like...
Code:
Button OnClick

  with me
    .combo1 = null
    .combo2 = null
    .combo1.locked = false
    .combo2.locked = false
  end with
 
Thanks for the advice.

This works well; however, there is a problem. For example, if the first entry is a service, not just the product field on the particular row is locked, but the entire Product column is locked. Using the button, this can be circumvented by click the next row then using the unlock button, but this is a bit of a hastle.

So, is it possible to make the lock apply to a particular entry? I included another picture.
 

Attachments

  • example.gif
    example.gif
    17 KB · Views: 105
This works well; however, there is a problem.
There is always another problem! :)
if the first entry is a service, not just the product field on the particular row is locked, but the entire Product column is locked.
That's probably because the entire column represents an entire field, and not just one single control on your form. Unfortunely, that's a consequence of applying table fields to form controls. I'm sure there is a work around for this, but its up to the developer to decide weather or not it is worth the time to figure it out.
So, is it possible to make the lock apply to a particular entry?
As in, locking the field on a conditional statement? Like, based on what combo box has been selected? There is an abundance of conditional statements you can use for this. If you are asking weather or not you can just lock the field control with respect to the current record; No, I don't believe you can: Because it is bound to the entire field. The control cannot receive special treatment just because it is being used to display a value from one record over another.

One other thing that comes to mind though: I bet you can lock the entire field based on the current record of the form, using either the AbsolutePostion property, or a conditional statement involving one of the fields' values (just another interesting thought, but probably not relevant! :)).
 

Users who are viewing this thread

Back
Top Bottom