473,394 Members | 1,774 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,394 software developers and data experts.

Problem with db.OpenRecodset(StrTblDate)

Hello there. I could use some help on a VBA issue I am encountering. I have adopted a system that needs to be modified, but I can figure out why this keeps breaking on this one spot and I can't figure out where to go. Everything I try to enter information in from a form, I error out on the same section Set rs1 = db.OpenRecordset(strtblDate). I could use a direction to find the answer.
Thanks!

Expand|Select|Wrap|Line Numbers
  1. Private Sub txtAccept_Exit(Cancel As Integer)
  2.     On Error GoTo Err_txtAccept_Exit
  3.     Dim db As Database
  4.     Dim rs1 As Recordset
  5.     Dim rs2 As Recordset
  6.  
  7.     If (Me!txtAccept = "T") Then
  8.         Set db = DBEngine(0)(0)
  9.         Set rs1 = db.OpenRecordset(strtblDate)
  10.         Set rs2 = db.OpenRecordset("qselEmployeeAdd")
  11.  
  12.         rs1.AddNew
  13.         rs1("NAME") = Me!txtName
  14.         rs1("EID") = Me!txtEnterEmployeeNumber
  15.         rs1("DEPT") = Me!txtDept
  16.         rs1("RACE") = rs2("RACE")
  17.         rs1("SEX") = rs2("SEX")
  18.         rs1("HIRE") = rs2("HIRE")
  19.         If (Me!txtEnterExpLevel = "D") Then
  20.             rs1("EXP") = "D"
  21.             rs1("EXPTIME") = 10
  22.         ElseIf (Me!txtEnterExpLevel = "I") Then
  23.             rs1("EXP") = "I"
  24.             rs1("EXPTIME") = 5
  25.         ElseIf (Me!txtEnterExpLevel = "N") Then
  26.             rs1("EXP") = "N"
  27.             rs1("EXPTIME") = 0
  28.         Else
  29.             MsgBox "Experience Level must be D, I or N", 64, "Job Posting System"
  30.             Exit Sub
  31.         End If
  32.         rs1.Update
  33.  
  34.         rs1.Close
  35.         rs2.Close
  36.         db.Close
  37.         Set rs1 = Nothing
  38.         Set rs2 = Nothing
  39.         Set db = Nothing
  40.         Me!txtEnterEmployeeNumber = ""
  41.         Me!txtName = ""
  42.         Me!txtName.Visible = False
  43.         Me!txtDept = ""
  44.         Me!txtDept.Visible = False
  45.         Me!txtEnterExpLevel = ""
  46.         Me!txtEnterExpLevel.Visible = False
  47.         Me!txtEnterEmployeeNumber.SetFocus
  48.         Me!txtAccept = ""
  49.         Me!txtAccept.Visible = False
  50.         Me!cmdOK.Visible = True
  51.     Else
  52.         Me!txtEnterEmployeeNumber = ""
  53.         Me!txtName = ""
  54.         Me!txtName.Visible = False
  55.         Me!txtDept = ""
  56.         Me!txtDept.Visible = False
  57.         Me!txtEnterExpLevel = ""
  58.         Me!txtEnterExpLevel.Visible = False
  59.         cmdClose.SetFocus
  60.         Me!txtAccept = ""
  61.         Me!txtAccept.Visible = False
  62.     End If
  63.  
  64. Exit_txtAccept_Exit:
  65.     Exit Sub
  66.  
  67. Err_txtAccept_Exit:
  68.     MsgBox Error$
  69.     Resume Exit_txtAccept_Exit
  70. End Sub 
Dec 2 '10 #1

✓ answered by hype261

Brian,

Is strtblDate is supposed to be a variable???? If so where is it declared.

Is is supposed to be a string??? In that case enclose it in quotes.

1 1379
hype261
207 100+
Brian,

Is strtblDate is supposed to be a variable???? If so where is it declared.

Is is supposed to be a string??? In that case enclose it in quotes.
Dec 2 '10 #2

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

Similar topics

0
by: Bruce Davis | last post by:
I'm having a problem on windows (both 2000 and XP) with a multi-threaded tkinter gui application. The problem appears to be a deadlock condition when a child thread pops up a Pmw dialog window in...
4
by: David Morgan | last post by:
Hi This is a really weird problem. We have a website that has been running for about six months with no problems. We have recently moved it to a new server with a new ISP. The server is of a...
11
by: Kostatus | last post by:
I have a virtual function in a base class, which is then overwritten by a function of the same name in a publically derived class. When I call the function using a pointer to the derived class...
7
by: Keith Dewell | last post by:
Greetings! My current job has brought me back to working in C++ which I haven't used since school days. The solution to my problem may be trivial but I have struggled with it for the last two...
117
by: Peter Olcott | last post by:
www.halting-problem.com
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
9
by: AceKnocks | last post by:
I am working on a framework design problem in which I have to design a C++ based framework capable of solving three puzzles for now but actually it should work with a general puzzle of any kind and I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
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...

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.