not in list event

P

patti

i have a combobox cboFindPatient that finds & displays the record. If the
patient is not in the list, i want the user to add data by using "add new
patient" button. (which works! thanks to the wisdom & kindness of the message
group)

i need to clear out what has been typed in the the cbo , display my message
and reset form. user then just clicks on add button.

I have set Limit to List: yes

these are events associated with cboFindPatient:

Private Sub cboFindPatient_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[PatientID] = " & Str(Nz(Me![cboFindPatient], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub



Private Sub cboFindPatient_NotInList(NewData As String, Response As Integer)

Me.cboFindPatient.Undo

Response = acDataErrContinue
MsgBox "Use Add New Patient Button"


End Sub


i kept getting prompted to select from list.

any help is appreciated.

patti
 
K

Klatuu

See if changing the Response will do the trick. I think it should be:

Response = acDataErrAdded
MsgBox "Use Add New Patient Button"

Also, be sure Limit To List is set to Yes.
 
P

patti

Thanks Klatuu. I had tried that - it brings up my message, then the default
message and tells me to make selection from list.

Basically, i'm guess i'm trying to code the escape key so that form is
"clean".

patti

Klatuu said:
See if changing the Response will do the trick. I think it should be:

Response = acDataErrAdded
MsgBox "Use Add New Patient Button"

Also, be sure Limit To List is set to Yes.

patti said:
i have a combobox cboFindPatient that finds & displays the record. If the
patient is not in the list, i want the user to add data by using "add new
patient" button. (which works! thanks to the wisdom & kindness of the message
group)

i need to clear out what has been typed in the the cbo , display my message
and reset form. user then just clicks on add button.

I have set Limit to List: yes

these are events associated with cboFindPatient:

Private Sub cboFindPatient_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[PatientID] = " & Str(Nz(Me![cboFindPatient], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub



Private Sub cboFindPatient_NotInList(NewData As String, Response As Integer)

Me.cboFindPatient.Undo

Response = acDataErrContinue
MsgBox "Use Add New Patient Button"


End Sub


i kept getting prompted to select from list.

any help is appreciated.

patti
 
K

Klatuu

Okay, try this, then: (It will allow the user to add the new record by
calling the click event code of the add new button)

Private Sub cboFindPatient_AfterUpdate()
' Find the record that matches the control.
Dim rs As Recordset

Set rs = Me.RecordsetClone
rs.FindFirst "[PatientID] = " & Str(Nz(Me![cboFindPatient], 0))
If rs.NoMatch Then
If MsgBox("No Match Found for " & Me.cboFindPatient & vbNewLine & _
"Okay to Add New Patient or Cancel to Retry", vbOkayCancel) =
vbOk Then
Call AddNewPatient_Click
Else
Me.cboFindPatient.Undo
End If
Else
Me.Bookmark = rs.Bookmark
End If
End Sub



patti said:
Thanks Klatuu. I had tried that - it brings up my message, then the default
message and tells me to make selection from list.

Basically, i'm guess i'm trying to code the escape key so that form is
"clean".

patti

Klatuu said:
See if changing the Response will do the trick. I think it should be:

Response = acDataErrAdded
MsgBox "Use Add New Patient Button"

Also, be sure Limit To List is set to Yes.

patti said:
i have a combobox cboFindPatient that finds & displays the record. If the
patient is not in the list, i want the user to add data by using "add new
patient" button. (which works! thanks to the wisdom & kindness of the message
group)

i need to clear out what has been typed in the the cbo , display my message
and reset form. user then just clicks on add button.

I have set Limit to List: yes

these are events associated with cboFindPatient:

Private Sub cboFindPatient_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[PatientID] = " & Str(Nz(Me![cboFindPatient], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub



Private Sub cboFindPatient_NotInList(NewData As String, Response As Integer)

Me.cboFindPatient.Undo

Response = acDataErrContinue
MsgBox "Use Add New Patient Button"


End Sub


i kept getting prompted to select from list.

any help is appreciated.

patti
 
P

patti

that didn't work either. but... i think i got it!

Private Sub cboFindPatient_NotInList(NewData As String, Response As Integer)

Response = acDataErrContinue
MsgBox "Use Add Patient Button"

Me.cboFindPatient.Undo
Me.Requery


End Sub


The message pops up, user clicks ok, form is returned to first record.

Thanks for your input, Klatuu. You helped get me there.

patti said:
Thanks Klatuu. I had tried that - it brings up my message, then the default
message and tells me to make selection from list.

Basically, i'm guess i'm trying to code the escape key so that form is
"clean".

patti

Klatuu said:
See if changing the Response will do the trick. I think it should be:

Response = acDataErrAdded
MsgBox "Use Add New Patient Button"

Also, be sure Limit To List is set to Yes.

patti said:
i have a combobox cboFindPatient that finds & displays the record. If the
patient is not in the list, i want the user to add data by using "add new
patient" button. (which works! thanks to the wisdom & kindness of the message
group)

i need to clear out what has been typed in the the cbo , display my message
and reset form. user then just clicks on add button.

I have set Limit to List: yes

these are events associated with cboFindPatient:

Private Sub cboFindPatient_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[PatientID] = " & Str(Nz(Me![cboFindPatient], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub



Private Sub cboFindPatient_NotInList(NewData As String, Response As Integer)

Me.cboFindPatient.Undo

Response = acDataErrContinue
MsgBox "Use Add New Patient Button"


End Sub


i kept getting prompted to select from list.

any help is appreciated.

patti
 
Top