A
Anthony Viscomi
I've got the following:
Private Sub Dealer_Name_NotInList(NewData As String, Response As Integer)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim srtMsg As String
srtMsg = "" & NewData & "'is not an avaialable Dealer Name " & vbCrLf &
vbCrLf
strMsg = strMsg & "Do you want to add the new Dealer Name to the list?"
strMsg = strMsg & vbCrLf & vbCrLf & "Click Yes to add or No to
re-select."
If MsgBox(strMsg, vbQuestion + vbYesNo, "Add new Dealer Name?") = vbNo
Then
Response = acDataErrContinue
Else
Set db = CurrentDb
Set rs = db.OpenRecordset("tbl_Dealer_Info", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!Dealer_Name = NewData
rs.Update
If Err Then
MsgBox "An error occurred. Please try again."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If
End If
DoCmd.OpenForm "frm_Dealer_Info"
Forms!frm_dealer_info.FilterOn = True
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub
Everything seems to work fine, except for the following portion:
DoCmd.OpenForm "frm_Dealer_Info"
Forms!frm_dealer_info.FilterOn = True
the Forms!frm_dealer_info filter is based on the value that the user has
just entered within a combobox on the form that triggered this not in list
event. My problem is that the filter only sees the previously entered value
not the new value. I guess this issue meets the criteria cited on
http://www.mvps.org/access/forms/frm0008.htm unfortunately I can't use this
method because the form that is being called to open contains all of the new
dealer's contact info and after it is updated another script runs to
populate fields within the Orders Form.
I guess may question is; can I committ the current value somewhere/somehow
using a command within the above code?
Thanks!
Anthony
Private Sub Dealer_Name_NotInList(NewData As String, Response As Integer)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim srtMsg As String
srtMsg = "" & NewData & "'is not an avaialable Dealer Name " & vbCrLf &
vbCrLf
strMsg = strMsg & "Do you want to add the new Dealer Name to the list?"
strMsg = strMsg & vbCrLf & vbCrLf & "Click Yes to add or No to
re-select."
If MsgBox(strMsg, vbQuestion + vbYesNo, "Add new Dealer Name?") = vbNo
Then
Response = acDataErrContinue
Else
Set db = CurrentDb
Set rs = db.OpenRecordset("tbl_Dealer_Info", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!Dealer_Name = NewData
rs.Update
If Err Then
MsgBox "An error occurred. Please try again."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If
End If
DoCmd.OpenForm "frm_Dealer_Info"
Forms!frm_dealer_info.FilterOn = True
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub
Everything seems to work fine, except for the following portion:
DoCmd.OpenForm "frm_Dealer_Info"
Forms!frm_dealer_info.FilterOn = True
the Forms!frm_dealer_info filter is based on the value that the user has
just entered within a combobox on the form that triggered this not in list
event. My problem is that the filter only sees the previously entered value
not the new value. I guess this issue meets the criteria cited on
http://www.mvps.org/access/forms/frm0008.htm unfortunately I can't use this
method because the form that is being called to open contains all of the new
dealer's contact info and after it is updated another script runs to
populate fields within the Orders Form.
I guess may question is; can I committ the current value somewhere/somehow
using a command within the above code?
Thanks!
Anthony