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

Need Help With Runtime errors

I have inherited a database and a number of tasks to complete regarding its design...

The one causing me the trouble is a form in which people enter data.
I need this form to return the correct information if an existing reference number is entered or allow new data to be entered if the reference number does not exist.

I have gone through a number of forums etc trying to get this working but it seems everytime I try one thing I get a new error message and I'm just going in circles!!

Please help!

I'm fairly new to VBA so go easy on me :)
Expand|Select|Wrap|Line Numbers
  1. Private Sub RefrenceNumber_BeforeUpdate(Cancel As Integer)
  2.     Dim rs As DAO.Recordset
  3.  
  4.                Set rs = Me.RecordsetClone
  5.         rs.FindFirst "[refrencenumber] = " & Me.RefrenceNumber
  6.                     Me.Bookmark = rs.Bookmark
  7.                 Set rs = Nothing
  8.  
  9. End Sub
This is one of my attempts which is giving me a run-time 3070 error.
May 5 '10 #1

✓ answered by Megalog

Expand|Select|Wrap|Line Numbers
  1. Private Sub RefrenceNumber_BeforeUpdate(Cancel As Integer)
  2.     Dim rs As DAO.Recordset
  3.  
  4.     Set rs = Me.Recordset.Clone
  5.     rs.FindFirst "[refrencenumber] = " & Me.RefrenceNumber
  6.     If rs.NoMatch = False Then
  7.         Me.Undo
  8.         Me.Bookmark = rs.Bookmark
  9.     End If
  10.     Set rs = Nothing
  11. End Sub
If 'refrencenumber' is actually a text format, not number, then use this in line #5:

Expand|Select|Wrap|Line Numbers
  1.     rs.FindFirst "[refrencenumber] = '" & Me.RefrenceNumber & "'"

4 1335
Megalog
378 Expert 256MB
Expand|Select|Wrap|Line Numbers
  1. Private Sub RefrenceNumber_BeforeUpdate(Cancel As Integer)
  2.     Dim rs As DAO.Recordset
  3.  
  4.     Set rs = Me.Recordset.Clone
  5.     rs.FindFirst "[refrencenumber] = " & Me.RefrenceNumber
  6.     If rs.NoMatch = False Then
  7.         Me.Undo
  8.         Me.Bookmark = rs.Bookmark
  9.     End If
  10.     Set rs = Nothing
  11. End Sub
If 'refrencenumber' is actually a text format, not number, then use this in line #5:

Expand|Select|Wrap|Line Numbers
  1.     rs.FindFirst "[refrencenumber] = '" & Me.RefrenceNumber & "'"
May 5 '10 #2
NeoPa
32,556 Expert Mod 16PB
In a rush now, but a couple of points :
  1. You spell reference number [RefrenceNumber].
  2. The error message (as opposed to the error code on its own) would be helpful information.
May 5 '10 #3
Thanks for taking the time to respond guys,

Megalog has cracked it for me with the line 5 change!

Thanks alot

Carl
May 7 '10 #4
NeoPa
32,556 Expert Mod 16PB
In that case you may be interested in a little light reading on the matter (Quotes (') and Double-Quotes (") - Where and When to use them).
May 7 '10 #5

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

Similar topics

5
by: JW | last post by:
Hi, I don't seem to get any results from the following use of Runtime.getRuntime().exec(cmd) using Java 1.4 on Redhat linux. Suppose that in the same directory as my java file below, I have...
4
by: Aaron W. LaFramboise | last post by:
I'm seeking a solution to my C++-life long dilemma of how to deal with errors when exceptions aren't appropriate. Below I highlight two error cases, which mainly occur when trying to handle...
3
by: colm | last post by:
i get the above runtime error on the following line of code when i try to update a reord in my form when it gets to the line Set rs = DBEngine(0)(0).OpenRecordset(strSql) the entire code...
12
by: ABeck | last post by:
Hello List, I have ar more or less academical question. Can there arise runtime errors in a program, if the include of <string.h> has been forgotten? If all the arguments to the functions of...
1
by: rp | last post by:
Hi, How would I create runtime tabpages with runtime controls(textBoxes,comboBox, checkedListBox), inserting,deleting, and modifing the tabpages whenever I want to in C#? Thanks in advance. rp
4
by: James | last post by:
I have the Application_Error event method in the Global.asax setup to send me an email regarding errors. But, I am getting reports from users that a specific page is producing a runtime error...
1
by: | last post by:
I'm having a problem finding the cause for this problem. I have a solution in Visual Studio 2005 that contains two projects -- a Web Site and a Class Library. The web site references the class...
1
by: rickcross | last post by:
I am trying to use the Access 2007 runtime. I have a program that is fully working in 2007 but when I install the runtime version with same Operating system and Access 2003 installed I have...
0
by: sg2611 | last post by:
I am getting a warning in my VB.Net application Warning Late bound resolution; runtime errors could occur. for the following code Private Function CreateReportHeader(ByRef ExcelApp As...
20
by: cowboyrocks2009 | last post by:
Hi, I need help to automate my code to take data from input file. Also I need to create it as a function so that I can pass it to some other program. I am new to Java so having a bit limitation to...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.