Marshall Brooks
Member
- Local time
- Today, 01:06
- Joined
- Feb 28, 2023
- Messages
- 696
Okay - obfuscating, but let's say I have three employee's in my group: Marshall Brooks, Tom Baker, and Joe Smith.
I have these people in a table named tblEmployees in a field called Names.
I have a combobox on a data form and I was using RowSourceType = Value List. and RowSource = "Marshall Brooks"; "Tom Baker"; "Joe Smith"
I changed this to RowSourceType = Table/Query and RowSourceType =
SELECT tblEmployees.Names FROM tblEmployees ORDER BY
Trim$(Mid$(tblEmployees.Names, InStr(tblEmployees.Names, " ") + 1))
Which sorts by last name (I don't include middle names).
Works fine.
Elsewhere, I have a USER FORM (not data form), that simulates an inputbox and has a combobox on it. For this, I was using:
Works fine.
I tried changing the comboBox1 values to:
With the ORDERBY clause it gave me a syntax error. With the above, I don't get a syntax error, but the user form never pops up either.
I think I could fix it with a form as opposed to a user form, but I already have the userform working elsewhere in the database.
Any ideas how to make it work?
I have these people in a table named tblEmployees in a field called Names.
I have a combobox on a data form and I was using RowSourceType = Value List. and RowSource = "Marshall Brooks"; "Tom Baker"; "Joe Smith"
I changed this to RowSourceType = Table/Query and RowSourceType =
SELECT tblEmployees.Names FROM tblEmployees ORDER BY
Trim$(Mid$(tblEmployees.Names, InStr(tblEmployees.Names, " ") + 1))
Which sorts by last name (I don't include middle names).
Works fine.
Elsewhere, I have a USER FORM (not data form), that simulates an inputbox and has a combobox on it. For this, I was using:
Code:
With InputBox1
.caption = "Select Employee:"
.TextBox1.value = "Please select the employee's name:"
.TextBox1.Font.Size = 10
.Height = 105
.TextBox1.Height = 40
.TextBox2.Height = 40
.ComboBox1.Top = 50
.ComboBox1.Style = fmStyleDropDownList
.ComboBox1.value = "Select Name"
.ComboBox1.AddItem "Marshall Brooks"
.ComboBox1.AddItem "Tom Baker"
.ComboBox1.AddItem "Joe Smith"
' Remove focus from the ComboBox so that the default value is NOT highlighted when the box opens.'
.OkButton.SetFocus
.Show
End With
Works fine.
I tried changing the comboBox1 values to:
Code:
.ComboBox1.Top = 50
.ComboBox1.Style = fmStyleDropDownList
.ComboBox1.value = "Select Verifier"
.ComboBox1.RowSourceType = "Table/Query"
.ComboBox1.RowSource = "SELECT tblEmployees.Names FROM tblEmployees"
With the ORDERBY clause it gave me a syntax error. With the above, I don't get a syntax error, but the user form never pops up either.
I think I could fix it with a form as opposed to a user form, but I already have the userform working elsewhere in the database.
Any ideas how to make it work?