By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,506 Members | 2,282 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,506 IT Pros & Developers. It's quick & easy.

Error: Jet Cannot Find 'tblBehavioralRating'

P: 1
I get that error when trying to create an error message when entering duplicate employee name by attaching to a field with a list box to the before update event. Here is the code I am using and I have tried everything including renaming the table so there is not a space between Behavioral Rating. Can anyone help?
Expand|Select|Wrap|Line Numbers
  1. Private Sub Employee_Name_BeforeUpdate(Cancel As Integer)
  2.  Dim Answer As Variant
  3.  
  4.  Answer = DLookup("[Employee_Name]", "tblBehavioralRating", "[Employee_Name] = '" & Me.Employee_Name & "'")
  5.  If Not IsNull(Answer) Then
  6.   MsgBox "Employee Record already exists" & vbCrLf & "Please use Find Record to Edit Button.", vbCritical + vbOKOnly + vbDefaultButton1, "Duplicate"
  7.  
  8.   Cancel = True
  9.   Me.Employee_Name.Undo
  10.  
  11.  Else:
  12.  End If
  13. End Sub
Jan 26 '12 #1
Share this Question
Share on Google+
3 Replies


Rabbit
Expert Mod 10K+
P: 12,316
What line is the error on and what is the error text?
Jan 26 '12 #2

dsatino
100+
P: 393
I think you should probably fix some other issues before trying to solve this. I have no idea what you're doing of course but, in general, using a name as unique identifier is not good practice since names are not unique. I'd guess there's probably an employee table and, hopefully, each employee has some sort of unique ID. You should use that instead. Which then brings us to the question of why you need a table for this. If an employee can have only one behavioral record, is there a reason for an additional table? Or maybe you just need to add a field(s) to your employee table.
Jan 26 '12 #3

NeoPa
Expert Mod 15k+
P: 31,186
Lisa, as Rabbit says this question (including title) makes no sense without the basic information. Surely no-one could possibly consider the error code alone adequate - without specifying even the line it occurred on or the text of the error message. Please remember in future as it will waste less of people's time and effort.

I looked up the error message from the number and it pertains to the table name supplied not matching any table or query in your database. From that I infer that your DLookup() line (#4) has the problem and that the problem is that your table is not actually called [tblBehavioralRating] at all. If the actual table name has a space in it then you can refer to it in the code as follows :
Expand|Select|Wrap|Line Numbers
  1. Answer = DLookup("[Employee_Name]", _
  2.                  "[tblBehavioral Rating]", _
  3.                  "[Employee_Name] = '" & Me.Employee_Name & "'")
PS. DSatino's point is also a good one and you should follow that up ;-)
Jan 27 '12 #4

Post your reply

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