H
Heather
I am trying to do something I've done a hundred times in previous version of
Access & can't get to work in 2007. I am trying to code a form pop-up when I
trigger a "not in list" error. I have tried my standard acdialog setting for
the docmd.openform command (see code below), I have also tried to manually
set the default of the pop-up form to modal & regardless I can't get the code
to stop running when the form pops up. I did a quick debug.print me.modal in
the pop-up form & it tells me it's modal (True) when I set the form itself to
modal, but not when it's called from VB using acDialog. To further my
annoyance I can't get the OpenArgs data to transition over either - but I
think the form has to be modal for that also.
Help! Is this a setting somewhere in 2007 that I need to change?
Code:
Private Sub Product_ID_NotInList(NewData As String, Response As Integer)
Dim strFrm As String
Dim strProduct As String
Dim intAnswer As Integer
Dim frmMyForm As Form
Set frmMyForm = Forms!frmOrderDetails
strFrm = "frmProduct"
strProduct = "Product_ID"
intAnswer = MsgBox("Add " & NewData & " to the Product list?", vbQuestion +
vbYesNo)
If intAnswer = vbYes Then
'Open the form to add new products
DoCmd.OpenForm strFrm, acFormDS, , , acFormAdd, acDialog
Response = acDataErrAdded
Me.Product_ID.Undo
Else
Response = acDataErrContinue
End If
End Sub
Access & can't get to work in 2007. I am trying to code a form pop-up when I
trigger a "not in list" error. I have tried my standard acdialog setting for
the docmd.openform command (see code below), I have also tried to manually
set the default of the pop-up form to modal & regardless I can't get the code
to stop running when the form pops up. I did a quick debug.print me.modal in
the pop-up form & it tells me it's modal (True) when I set the form itself to
modal, but not when it's called from VB using acDialog. To further my
annoyance I can't get the OpenArgs data to transition over either - but I
think the form has to be modal for that also.
Help! Is this a setting somewhere in 2007 that I need to change?
Code:
Private Sub Product_ID_NotInList(NewData As String, Response As Integer)
Dim strFrm As String
Dim strProduct As String
Dim intAnswer As Integer
Dim frmMyForm As Form
Set frmMyForm = Forms!frmOrderDetails
strFrm = "frmProduct"
strProduct = "Product_ID"
intAnswer = MsgBox("Add " & NewData & " to the Product list?", vbQuestion +
vbYesNo)
If intAnswer = vbYes Then
'Open the form to add new products
DoCmd.OpenForm strFrm, acFormDS, , , acFormAdd, acDialog
Response = acDataErrAdded
Me.Product_ID.Undo
Else
Response = acDataErrContinue
End If
End Sub