Error when adding to Combo List

kellan4459

Registered User.
Local time
Today, 17:49
Joined
Nov 26, 2001
Messages
31
Here is my code:
Private Sub Combo35_NotInList(NewData As String, Response As Integer)
Dim db As Database, rs As Recordset
Dim strMsg As String
strMsg = "'" & NewData & "' is not an available Social Security Number."

strMsg = strMsg & " Click Yes to Add or No to re-type it."
If MsgBox(strMsg, vbQuestion + vbYesNo, "Add new name?") = vbNo Then
Response = acDataErrContinue
Else
Set db = CurrentDb
Set rs = db.OpenRecordset("EmployeeData", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!Combo35 = NewData
rs.Update

If Err Then
MsgBox "An error occurred. Please try again."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If
End If

End Sub


Here is my error:
Run-time error 13:

Type Mismatch

what might cause this?
 
I seem to have gotten past that error message but now the field is not updated because an error is occuring prior the item being added. any ideas?
 
What version of Access are you using? What is the error message?

[This message has been edited by Jack Cowley (edited 11-28-2001).]
 
Jack,
What I am trying to do is create a combo box that will allow the person to lookup all employees that have been entered. If the person has not been entered it will prompt them to make sure they want to add the person. Once added it will allow them to add the rest of the information such as name and so on. If the person is already in the database it should update all the fields for viewing. Basically what I have is
Table:
EmployeeData

Fields: SSN,LastName,FirstName,MiddleInitial,OriginalHireDate,OriginalPayRate,Discipline,Level

The combo Box is SSN bound with the text boxes bound to the other fields.
OnUpdate needs to check the ssn for prior entry, if not there allow addition of employee data, if there needs to display employee data. I have code but it isn't working. The above code has since been deleted because I am going a different approach. I think I have ran in so many circles that I have confused myself on the best way to ensure this.
Access 2000
[This message has been edited by kellan4459 (edited 11-28-2001).]

[This message has been edited by kellan4459 (edited 11-28-2001).]
 
I believe that I sent you the Article on how to use the Not In List event. There are two methods described and the second method will open a form that will allow the users to add addition information about the employee, etc. You are using the first method described and all this does is save the information that the user just typed in. Here is the article again and I would suggest that you implement the second method. Let me know if you run into problems and good luck!

http://support.microsoft.com/support/kb/a rticles/Q197/5/26.ASP?LN=EN-US&SD=gn&FR=0&qry=q197526&rnk=1&src=DHCS_MSPSS_gn_SRCH&SPR=ACC97



[This message has been edited by Jack Cowley (edited 11-29-2001).]
 

Users who are viewing this thread

Back
Top Bottom