Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array? 1

Status
Not open for further replies.

gmacg

Technical User
May 29, 2002
41
US
I have a form with 10 combo boxes for 10 possible fields in a lot number. The following is the code for the first combo box. Is there a way around coding all of this for each combo box? The combo box is bound to a table of lot number fields. Once the fields are selected, I string them all together to create the lot number text that is bound to the lot number field. The reason I'm doing this is because a manager creates the lot numbers exept for the fields that operators have to fill in such as shift, etc. If anyone knows a better way, I'd appreciate it if you would point me in the right direction.

Select Case cmbField1
Case 1
txtField1.Value = Format(Format(Date, "yy"), "0")
Case 2
txtField1.Value = Format(Format(Date, "y"), "000")
Case 3
txtField1.Value = "S"
Case 4
txtField1.Value = " "
txtField1.SetFocus
txtField1.SelLength = Len(txtField4)
txtField1Prompt.Value = "<----Enter shift A, B, or C"
Case 5
txtField1.Value = " "
Case 6
txtField1.Value = " "
Case 7
txtField1.Value = "G2"
Case 8
txtField1.Value = DatePart("m", Date)
Case 9
txtField1.Value = DatePart("d", Date)
Case 10
txtField1.Value = Format(Format(Date, "yy"), "0")
End Select
 
erm, not sure what you are asking in the 2nd part but for the first part, you can put that code into a general function, and the use the me.Controls("tbxName" & idx) to call the different text boxes...
This does assume that you have the same parameters for each combo box.

--------------------
Procrastinate Now!
 
Thanks! That's what I was looking for. Hopefully, I can figure out how to do that. If not, I'll be back....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top