orders form... performing lookup or manual entry..

G

Guest

Good Day,

I have a form that I use for my order entries.... I have three types of
orders: Custom, Program, and Sample. If the order is a custom or sample
order, the user will input all order details... (design name, design number,
colours, size, etc..)

If the order is a Program order, I want the design name box to act as a
lookup combo box, that will look up on my tblprograminventory...

Can anyone help me... give me some tips... point me in the right
direction...

Thanks,

Brook
 
G

Guest

Hi Brook,
You could have both a textbox and a combobox, placed one on top of the other
so that they both occupy the same position. Start your form with (say) the
Textbox.Visible = True and the ComboBox.Visible = False.
If your user selects to do a Program Order then just reverse the visibility.
:)
 
G

Guest

Thank you for the tip,

Would I have to code all of my fields visible true / false depending on
the order type selection?

Can you help me with the " IF " code for the process?



Brook
 
G

Guest

Hi Brook,
It depends on how many control types you want to change.
I was presuming that you only wanted to change the "design_name" control
according to your users selection. On that basis how they make that
selection will depend on how you structure the "If" statement to show/hide
the relevant control. Lets say you have put the Order "type" into a combobox
for the user to choose the relevant type. Since these 3 types are fixed you
may not have put them into a table, but I would suggest that you do so that
you can add different types in the future. (Someone is bound to want a
different type added just as you finish the application!!)
So, the ordertypeCombo data source is set to your ordertypes table and has
the type_id in column(0) and the text description in column(1) - with
colum(0) width set to zero so it doesn't show.
On the basis that users may also use the form to move from one order record
to another then it would be best to put our code to change the contol
visibility into a seperate procedure in the forms code module so that it can
be called from both the ordertypeCombo_Click event and the Form_Current
Event. Also we will use "Select Case" rather than "If" as there may be more
than one option in the future and it would be easy to add to this and still
have it looking readable.
So:-
Private Sub ChangeControls()
Dim intType As Integer
intType = ordertypeCombo.Column(0)
Select Case intType
Case 1 'Custom Order
TextboxOrderType.Visible = True
ComboBoxOrderType.Visible = False

Case 2 'Program Order
TextboxOrderType.Visible = False
ComboBoxOrderType.Visible = True

Case 3 'Sample Order
TextboxOrderType.Visible = True
ComboBoxOrderType.Visible = False

Case Else ' its found a value we havent catered for
TextboxOrderType.Visible = True
ComboBoxOrderType.Visible = False

End Select

End Sub

---Then in the 2 Event procedures we just type - ChangeControls

Does that help?
Geoff.
 

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