validation rule from combo

Ade F

Avid Listener
Local time
Today, 23:22
Joined
Jun 12, 2003
Messages
97
input mask from combo

Although I have not yet looked deeply into this scenario I'm asking to see if anyone had approached this before. What I need to do is change a text box input mask dependant on a user choosing a combo box. The reason being I would like to record delivery note numbers in turn different suppliers have different delivery note formats.

If I could record the format of each supplier in a table some how (We are a small company and do not have loads of suppliers) then the user would have to input the del. note number in keeping with the supplier del.format.

Any ideas people?

Regards

Ade
 
Last edited:
Here it is

Here is what I'll do:

Suppose you have a Table named TSuppliers with a field named delNoteFormat that contains the format of the delivery note. (ex.: "000\-0000\ 00" for a delivery note like 123-4567 89)

Your combobox (named cboSuppliers) contains the name of the suppliers in the first column and the delNoteFormat field in the second one. It is bound by the Supplier name.

Your textbox is named txtDeliveryNote.

Then you add an afterupdate event to cboSuppliers:

Code:
Private Sub cboSuppliers_AfterUpdate()
    ' Put the value contained in the second column of the combobox in the inputmask of your textbox
    txtDeliveryNote.InputMask = cboSuppliers.column(1)
    ' You might need to do this to apply the changes, but try without it first
    Me.refresh
End Sub

This code is untested, but give it a try and come back if you have any questions.
 
Many thanks LaBelette I will have a go and keep you posted.

Regards

Ade
 
Works

with a bit of jiggery pockery (changed names and event details etc) I got it working.

Like a charm

Many thanks

Ade
 

Users who are viewing this thread

Back
Top Bottom