S
Scott Simonson
I have a form and I am trying to show the values from a table but also
trying to add an additional value. When I activate the form and then click
the dropdown arrow no values show. Here is what I got for code:
Private Sub Form_Open(Cancel As Integer)
On Error GoTo FormOpenError
Dim rsCutType As Recordset
Dim strCutTypeList As String
Caption = "Cut Type"
lblPrompt.Caption = "Select Cut Type"
Set rsCutType = CurrentDb.OpenRecordset("SELECT * FROM tblCutType")
Do While Not rsCutType.EOF
strCutTypeList = strCutTypeList & rsCutType.Fields!CutType & ";"
rsCutType.MoveNext
Loop
strCutTypeList = "All Cut Types;" & strCutTypeList
strCutTypeList = Left$(strCutTypeList, Len(strCutTypeList) - 1)
cbCutType.RowSourceType = "Value List"
cbCutType.RowSource = strCutTypeList
cbCutType.Requery
Refresh
cbCutType.Value = "All Cut Types"
FormOpenExit:
Exit Sub
FormOpenError:
MsgBox Err.Description
Cancel = True
GoTo FormOpenExit
End Sub
How do I show the values?
Thanks,
Scott
trying to add an additional value. When I activate the form and then click
the dropdown arrow no values show. Here is what I got for code:
Private Sub Form_Open(Cancel As Integer)
On Error GoTo FormOpenError
Dim rsCutType As Recordset
Dim strCutTypeList As String
Caption = "Cut Type"
lblPrompt.Caption = "Select Cut Type"
Set rsCutType = CurrentDb.OpenRecordset("SELECT * FROM tblCutType")
Do While Not rsCutType.EOF
strCutTypeList = strCutTypeList & rsCutType.Fields!CutType & ";"
rsCutType.MoveNext
Loop
strCutTypeList = "All Cut Types;" & strCutTypeList
strCutTypeList = Left$(strCutTypeList, Len(strCutTypeList) - 1)
cbCutType.RowSourceType = "Value List"
cbCutType.RowSource = strCutTypeList
cbCutType.Requery
Refresh
cbCutType.Value = "All Cut Types"
FormOpenExit:
Exit Sub
FormOpenError:
MsgBox Err.Description
Cancel = True
GoTo FormOpenExit
End Sub
How do I show the values?
Thanks,
Scott