B
brownti via AccessMonster.com
i am using the following code to create a new entry in tblRoomName when an
entry in my combobox is different than the listed entries:
Private Sub Combo22_NotInList(NewData As String, Response As Integer)
Set dbs = CurrentDb
strAuth = "'" & NewData & "' is not in the list. "
strAuth = strAuth & "Would you like to add it?"
If MsgBox(strAuth, vbYesNo + vbQuestion, "New Group Diagnosis") = vbNo Then
Response = acDataErrDisplay
Else
Set rst = dbs.OpenRecordset("tblRoomName")
rst.AddNew
rst![RoomType] = NewData
rst.Update
Response = acDataErrAdded
rst.Close
dbs.Close
End If
End Sub
It works as far as creating the new entry in the table, however record one is
selected and i cant navigate to the newley created record. For example if i
have 3 records, (Living Room, Dining Room, Bathroom) and i type Bedroom in
the combobox it tells me that that is not in the list and if i would like to
select it. I say yes and it puts that value in my combobox but shows me
record 1 of 3. if close the form and reopen it and select bedroom it shows
me record 4 of 4 (which would be correct) any ideas what is going on or how
i can fix this? THanks.
entry in my combobox is different than the listed entries:
Private Sub Combo22_NotInList(NewData As String, Response As Integer)
Set dbs = CurrentDb
strAuth = "'" & NewData & "' is not in the list. "
strAuth = strAuth & "Would you like to add it?"
If MsgBox(strAuth, vbYesNo + vbQuestion, "New Group Diagnosis") = vbNo Then
Response = acDataErrDisplay
Else
Set rst = dbs.OpenRecordset("tblRoomName")
rst.AddNew
rst![RoomType] = NewData
rst.Update
Response = acDataErrAdded
rst.Close
dbs.Close
End If
End Sub
It works as far as creating the new entry in the table, however record one is
selected and i cant navigate to the newley created record. For example if i
have 3 records, (Living Room, Dining Room, Bathroom) and i type Bedroom in
the combobox it tells me that that is not in the list and if i would like to
select it. I say yes and it puts that value in my combobox but shows me
record 1 of 3. if close the form and reopen it and select bedroom it shows
me record 4 of 4 (which would be correct) any ideas what is going on or how
i can fix this? THanks.