G
Gary Davidson
Hi all,
This one is drving me mad and searching through the NG it would seem
Im not alone.
I have a form where the user selects a product type from a combo box.
Based on their selection a sub category combo displays all models for
that product. Users can enter a new model if it does not exist.
Problem is I need to set the focus back to the first combo box to read
the contents i.e. server or client and then display the appropriate
form for the user to add a new product.
I am using the NotInList. I have tried several variations as my code
will show but with no joy. I just get the run-time error 2110 cannot
move the focus to the control!!!
Private Sub ComboSubCat_NotInList(NewData As String, Response As
Integer)
'Forms!TechInDB!ComboProductID.SetFocus
DoCmd.GoToControl "ComboProductID"
'Me!ComboProductID.SetFocus
Select Case ComboProductID.Text
Case "Server"
'If ComboProductID.Text = "Server" Then
If MsgBox("Server Product Not In Database, Add?", vbYesNo +
vbQuestion, "Please Respond") = vbYes Then
DoCmd.OpenForm "FrmServer", _
Datamode:=acFormAdd, _
WindowMode:=acDialog, _
OpenArgs:=NewData
If IsLoaded("FrmServer") Then
Response = acDataErrAdded
DoCmd.Close acForm, "FrmServer"
Else
Response = acDataErrContinue
End If
Else
Response = acDataErrContinue
End If
End Select
End Sub
Please tell me where I am going wrong, im still finding my feet in the
access world!
Thanks
Gary
This one is drving me mad and searching through the NG it would seem
Im not alone.
I have a form where the user selects a product type from a combo box.
Based on their selection a sub category combo displays all models for
that product. Users can enter a new model if it does not exist.
Problem is I need to set the focus back to the first combo box to read
the contents i.e. server or client and then display the appropriate
form for the user to add a new product.
I am using the NotInList. I have tried several variations as my code
will show but with no joy. I just get the run-time error 2110 cannot
move the focus to the control!!!
Private Sub ComboSubCat_NotInList(NewData As String, Response As
Integer)
'Forms!TechInDB!ComboProductID.SetFocus
DoCmd.GoToControl "ComboProductID"
'Me!ComboProductID.SetFocus
Select Case ComboProductID.Text
Case "Server"
'If ComboProductID.Text = "Server" Then
If MsgBox("Server Product Not In Database, Add?", vbYesNo +
vbQuestion, "Please Respond") = vbYes Then
DoCmd.OpenForm "FrmServer", _
Datamode:=acFormAdd, _
WindowMode:=acDialog, _
OpenArgs:=NewData
If IsLoaded("FrmServer") Then
Response = acDataErrAdded
DoCmd.Close acForm, "FrmServer"
Else
Response = acDataErrContinue
End If
Else
Response = acDataErrContinue
End If
End Select
End Sub
Please tell me where I am going wrong, im still finding my feet in the
access world!
Thanks
Gary