473,320 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How do I eliminate the Error msg although criteria is found?

3
hello group,
TK2 (New member)
Kindly look at the code below. It returns an error although the employee name is found. I'm stuck. Can someone help?

Expand|Select|Wrap|Line Numbers
  1. Sub EmployeeHours()
  2. On Error GoTo errorHandler:
  3.  
  4. '*********************
  5.  Dim Rng As Range
  6.  
  7.    Set Rng = Range("j3:j528").Cells.Find(what:=InputBox("Enter Employee Name First"), _
  8.       LookAt:=xlWhole, LookIn:=xlValues)
  9.    If Rng = "" Then
  10.       MsgBox "Employee Name Not Found !"
  11.       Exit Sub
  12.    Else
  13.     Rng.Select
  14.    End If
  15.  
  16. errorHandler: MsgBox "Entry Not Valid!" & vbNewLine & "Click 'OK' To Search Again.", vbOKOnly, "Admin"
End Sub
Thank you
Tk2
Oct 7 '07 #1
3 976
TK2
3
hello to all..
The above post...(hoping its in the right forum) refers to an Excel sheet with VB.
thanks again.
TK2
Oct 8 '07 #2
Killer42
8,435 Expert 8TB
Please give us details of the error reported, and which line generates it. (You may need to temporarily remove your On Error to find out).
Oct 8 '07 #3
Killer42
8,435 Expert 8TB
P.S. If Rng = "" - is it valid to compare a range to a string?
Oct 8 '07 #4

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

Similar topics

6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
7
by: Richard Yardley | last post by:
I have a mailing label report and would like to remove the space taken up by rows with no info (move the other rows up). I am a beginner using MS Access 2000 and would appreciate any help. ...
2
by: Jimbo | last post by:
I have an access 97 database linked to sql server..I click update on a form and get an error message: Run-time error 3146 ODBC call failed The debugger points to this line: MyTable.Update
3
by: martlaco1 | last post by:
Trying to fix a query that (I thought) had worked once upon a time, and I keep getting a Data Type Mismatch error whenever I enter any criteria for an expression using a Mid function. Without the...
10
by: Jim Underwood | last post by:
I am having a problem with my web page timng out while retrieving a long runnign report (90-120 seconds. I have tried modifying several settings in various places and cannot get it to run for more...
5
by: iheartvba | last post by:
Hi Everyone, I keep on getting an error saying Compile Error: Expected Case in my (MS Access) VBA What I was trying to do was to do a DSUM function for a Table where the criteria was coming from...
4
by: tasmontique | last post by:
Hello everyone, I keep getting a syntax error in my update statement. The only thing that I notice is that although the columns in my table have the same name as the fields on the form the...
3
by: =?Utf-8?B?TWlrZVM=?= | last post by:
Below is the code for 2 separate functions. The first one gets data from an Access database and works fine. The second one is almost a duplicate except it gets data from an SQL database. It...
2
by: Denise | last post by:
Front end is Access 2002, back end is linked Oracle tables. My users need to describe things in feet and inches and want to use the standard ' and " abbrevations. On a testing form I go to a...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.