473,473 Members | 1,419 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

type mismatch problem Help!!!!!!!!!

52 New Member
hi,
i'm creating a search button. When i click the button an input box shows up where i then enter the name of the employee and the result is show on a list box. Im using vb 6 and access.

my form load
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2. '
  3. Set GR_Database = OpenDatabase(App.Path & "\GR_database.mdb")
  4. Set rsEmployee = GR_Database.OpenRecordset("Employee", dbOpenDynaset)
  5.  
  6. If Not rsEmployee.EOF Then rsEmployee.MoveFirst
  7.  
  8. Do While Not rsEmployee.EOF
  9.     lstEmployee.AddItem rsEmployee!Firstname & vbTab & vbTab & rsEmployee!EmployeeNo
  10.     lstEmployee.ItemData(lstEmployee.NewIndex) = rsEmployee!EmployeeNo
  11.     rsEmployee.MoveNext
  12. Loop
  13. End Sub

the problem i get is a type mismatch on the firstline in my listbox
My Listbox
Expand|Select|Wrap|Line Numbers
  1. Private Sub lstEmployee2_Click()
  2.  
  3. rsEmployee.FindFirst "EmployeeNo=" & Str(Split(lstEmployee2.List(lstEmployee2.ListIndex), vbTab)(0))
  4.  
  5.     txtEmployeeNo.Text = rsEmployee!EmployeeNo
  6.     txtFirstName.Text = rsEmployee!Firstname
  7.     txtSurname.Text = rsEmployee!Surname
  8.     'i cut the rest out
  9. End Sub
And this is my search button
Expand|Select|Wrap|Line Numbers
  1. Private Sub CmdSearch_Click()
  2.  
  3. Set GR_Database = OpenDatabase(App.Path & "\GR_database.mdb")
  4.     Set rsEmployee = GR_Database.OpenRecordset("Employee", dbOpenDynaset)
  5. Dim Name As String
  6.  
  7. Name = InputBox("Please insert name", "Name") 'Enter the name to search for
  8.  
  9. If Not rsEmployee.EOF Then rsEmployee.MoveFirst
  10. Call cmdClear_Click
  11. lstEmployee2.Clear
  12. Do While Not rsEmployee.EOF
  13.     If LCase(rsEmployee!Firstname) = LCase(Name) Then
  14.     lstEmployee2.AddItem rsEmployee!Firstname & " " & rsEmployee!Surname
  15.         End If
  16.        rsEmployee.MoveNext
  17. Loop
  18. End Sub
i don't know why i get this problem on rsEmployee.FindFirst "EmployeeNo=" & Str(Split(lstEmployee2.List(lstEmployee2.ListIndex ), vbTab)(0))
i used the same code on a similar project and it worked well, this piece of code was form a friend so i don't really know how it works.

PLEASE HELP!!!!
Mar 11 '08 #1
1 1188
debasisdas
8,127 Recognized Expert Expert
That is because you are passing a string to a number filed in the database for search.
Mar 11 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Laura | last post by:
Help. Below is my code. Getting Type mismatch error on the noted line. I'm trying to send an array (aryNewD) with 4 columns and x rows to a function to save all the array info into a SQL Server...
5
by: Arun Wadhawan | last post by:
Hello MY SQL Server is causing me this problem : Microsoft VBScript runtime error '800a000d' Type mismatch: 'ident' >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> I am getting from...
1
by: LJgrnl | last post by:
I've got a type mismatch error that's driving me nutty. Variable blnNoData has the initial value False. If a recordset comes back empty (both .EOF and ..BOF are true) then blnNoData is set to...
4
by: Mike | last post by:
I am getting a type mismatch error when I do a bulk insert. ---Begin Error Msg--- Server: Msg 4864, Level 16, State 1, Line 1 Bulk insert data conversion error (type mismatch) for row 1, column...
1
by: Brett | last post by:
I have a form that calls a method within a DLL. By clicking a button on the form, the DLL is instantiated and the SaveOutlookMessage() method invoked. The DLL code copies messages from Outlook to...
6
by: isaac2004 | last post by:
hello i am getting a type mismatch for a page i am trying to write. any help would be great source code <%@ Language=VBScript %> <% Option Explicit %> <!--#include...
2
by: Rehan | last post by:
Hi there! Please help me out here. I am an inch away from completing my assignment. I am very new to VBA but i have very less time to be efficient at it. I am getting a type mismatch error...
5
by: daniel.hedz | last post by:
I am generating a usercontrol dynamically successfully, but when I try to find that usercontrol I get a type mismatch. This is what I am doing: //Loading my usercontrol...
1
by: nckinfutz | last post by:
hello, I am having a problem with an access database. this is not my database and I did not create it, nor am I very good at access. however, I am a network engineer and that is why this problem...
1
by: crookward | last post by:
I usually have no problem identifying a type mismatch error, but this one's got me pulling my hair out. The mismatch error is pointing to line 269, which is a blank line, and it's also within an if...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.