Populate combo from previous selection

W

Wayne

I'm using the following cose on the Got Focus event of a
combo.

Private Sub PaperSize_GotFocus()

'Start
Dim strSqlSelect4 As String
Dim strSqlOrder4 As String
Dim strSqlWhere4 As String

' If Me.Type Then

'Create SQL Query
strSqlSelect4 = "SELECT PrintFeeID, PrintTypeID,
PaperSize " & _
"FROM [Print_Fee] "

'Where
strSqlWhere4 = " WHERE [Print_Fee].PrintTypeID=" _
& [Forms]![PrintReq_Subform]![Type]

'Order by
strSqlOrder4 = " ORDER BY PaperSize "


'Put strings together to form complete statement
Me!PaperSize.RowSource = strSqlSelect4 &
strSqlWhere4 & strSqlOrder4 & ";"

' End If

End Sub

The intention is for the values in the PaperSize combo to
update depending on the value selected in the Type combo.
It works but when I move the focus to other fields the
selected values in PaperSize disapear. I think there is
also a problem when i use this form as a subform.

I hope that makes sense.

Thanks
 

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

Similar Threads


Top