E
ElizCat
I have a combo box used to select a StyleID, which happens to also be the
primary key for the Style table. If the style does not exist in the list,
the user can double-click to add a new style, launching a popup form in
dialog mode. I've cobbled together the code below from a couple of examples
(from similar questions in this forum), but when I close the popup form, my
combo box on the main form does not reflect the updated value. I don't want
to use NotInList, since the StyleID is a primary key, and I don't want the
users typing in those values. I'm using Access 2002.
Can any of you seasoned pros help me figure out what I'm doing wrong?
Thanks - ElizCat
'***************test code******************
Private Sub StyleID_DblClick(Cancel As Integer)
'double click to add new style to Style
Dim FormName As String
Dim mbrResponse As VbMsgBoxResult
Dim strMsg As String
FormName = "StylePopUp"
strMsg = "Add new Style?"
mbrResponse = MsgBox(strMsg, _
vbYesNo + vbQuestion)
Select Case mbrResponse
Case vbYes
DoCmd.OpenForm (FormName), _
DataMode:=acFormAdd, _
WindowMode:=acDialog, _
OpenArgs:=NewData
'Stop Here and wait until the form goes away
If fIsLoaded(FormName) Then
Response = acDataErrAdded
DoCmd.Save
Me!StyleID.Requery
DoCmd.Close acForm, (FormName)
Else
Response = acDataErrContinue
End If
Case vbNo
Response = acDataErrContinue
End Select
End Sub
primary key for the Style table. If the style does not exist in the list,
the user can double-click to add a new style, launching a popup form in
dialog mode. I've cobbled together the code below from a couple of examples
(from similar questions in this forum), but when I close the popup form, my
combo box on the main form does not reflect the updated value. I don't want
to use NotInList, since the StyleID is a primary key, and I don't want the
users typing in those values. I'm using Access 2002.
Can any of you seasoned pros help me figure out what I'm doing wrong?
Thanks - ElizCat
'***************test code******************
Private Sub StyleID_DblClick(Cancel As Integer)
'double click to add new style to Style
Dim FormName As String
Dim mbrResponse As VbMsgBoxResult
Dim strMsg As String
FormName = "StylePopUp"
strMsg = "Add new Style?"
mbrResponse = MsgBox(strMsg, _
vbYesNo + vbQuestion)
Select Case mbrResponse
Case vbYes
DoCmd.OpenForm (FormName), _
DataMode:=acFormAdd, _
WindowMode:=acDialog, _
OpenArgs:=NewData
'Stop Here and wait until the form goes away
If fIsLoaded(FormName) Then
Response = acDataErrAdded
DoCmd.Save
Me!StyleID.Requery
DoCmd.Close acForm, (FormName)
Else
Response = acDataErrContinue
End If
Case vbNo
Response = acDataErrContinue
End Select
End Sub