I am using a basic form.
I have an unbound combo list to pull listing of items. (The item is not the primary key but however it is indexed).
What I am trying to accomplish is this:
When the user enter a non existing item, I prompt the user if they want to create the item. (the code is in On not in list:
The property for the Cmbitem are as follows:
CmboItem:
unbound
Limit to list=Yes
Events=
---- After Update: (default by access)
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Item] = '" & Me![CmbItem] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End sub
Events=
---- On Not in List:
Private Sub CmbItem_NotInList(NewData As String, Response As Integer)
Dim sAns As String
sAns = MsgBox("Create item " & NewData, vbQuestion + vbYesNo, "New")
If sAns = vbYes Then
'????????????????????????????????????????????????
'*** This is where I am having the problem,
' It will not execute the addition of new record
'it gets stuch in a loop when sAns = vbYes
' ???????????????????????????????????????????????
DoCmd.GoToRecord , , acNewRec
Item = NewData
CmbItem = Item
End If
End Sub
Please advice,
Thank you
Dré
I have an unbound combo list to pull listing of items. (The item is not the primary key but however it is indexed).
What I am trying to accomplish is this:
When the user enter a non existing item, I prompt the user if they want to create the item. (the code is in On not in list:
The property for the Cmbitem are as follows:
CmboItem:
unbound
Limit to list=Yes
Events=
---- After Update: (default by access)
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Item] = '" & Me![CmbItem] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End sub
Events=
---- On Not in List:
Private Sub CmbItem_NotInList(NewData As String, Response As Integer)
Dim sAns As String
sAns = MsgBox("Create item " & NewData, vbQuestion + vbYesNo, "New")
If sAns = vbYes Then
'????????????????????????????????????????????????
'*** This is where I am having the problem,
' It will not execute the addition of new record
'it gets stuch in a loop when sAns = vbYes
' ???????????????????????????????????????????????
DoCmd.GoToRecord , , acNewRec
Item = NewData
CmbItem = Item
End If
End Sub
Please advice,
Thank you
Dré