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

Run time error 2001

60
Hi
Sorry to keep asking questions but I keep getting a run-time error 2001 "you canceled the previous operation" error whenever the code in the Dlookup line is reached. I have a table called Alphabet_lookup that I'm simply trying to extract a letter from depending on the value of counter . I first thought that "Letter" might be a reserved word so I changed the field name and still get the same error.

It's frustrating spending an entire afternoon on something like this. Thanks for any help.


Splits = Val([Forms]![Splits_Form]![Number_of_Splits_Textbox])
COUNTER = 1
Dim ltr As String
Do
Do While COUNTER <= Splits

ltr = DLookup("[LETTER]", "Alphabet_lookup", "[split_num] = Counter")
Set db = CurrentDb
Set rs = db.OpenRecordset("Count_Stations")
rs.AddNew
rs("PCID") = DMax("[PCID]", "Count_Stations") + 1
rs("Counting_S") = Forms!count_stations_form!COUNTING_S & ltr & "-" & get_global("g_group")
rs("Street") = Forms!count_stations_form!STREET
rs("Cross_St1") = Forms!count_stations_form!CROSS_ST1
rs("Cross_St2") = Forms!count_stations_form!CROSS_ST2
rs("Cnty_fips") = Forms!count_stations_form!CNTY_FIPS
rs("Status") = "add/split"
rs("Action_Note") = "ADD:as per SPLIT"
rs("Creation_date") = Date
rs.Update
rs.Close



If COUNTER = Splits Then
done = yes
Exit Do
End If
COUNTER = COUNTER + 1
Loop
Loop Until done = yes
Nov 26 '08 #1
3 1177
ChipR
1,287 Expert 1GB
"[split_num] = Counter")

should be

"[split_num] = " & Counter)

?
Nov 26 '08 #2
ramprat
60
Thank you Chip! That fixed it right up. You are indeed a gentleman!
Nov 26 '08 #3
missinglinq
3,532 Expert 2GB
The syntax Chip gave you is valid when the field in the Where condition is Numeric. Fields that are Text or Date require a slightly different syntax. For future reference:

'Where EmpNameID is Numeric
Expand|Select|Wrap|Line Numbers
  1.  Me.Wage = DLookup("wage", "Employees", "[NameID] = " & Me.EmpNameID)
  2.  
'Where EmpNameID is
Expand|Select|Wrap|Line Numbers
  1. Text
Me.Wage = DLookup("Wage", "Employees", "[NameID] = '" & Me.EmpNameID & "'")

'For Date fields
Expand|Select|Wrap|Line Numbers
  1. DLookup("[FieldNameToReturn]", "TableName", "[CriteriaField] = #" & Me.YourDate & "#")
This same type of syntax is also valid when using DLookUp(), DMax() DSum() and so forth.

And to both of you, Welcome to Bytes!

Linq ;0)>
Nov 26 '08 #4

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

Similar topics

11
by: frr | last post by:
Hi, After upgrading to 2.4 (from 2.3), I'm getting a weird syntax error: >>> import themes Traceback (most recent call last): File "<interactive input>", line 1, in ? File "themes.py", line...
2
by: Artur | last post by:
Hi Newsgroup, im currently working on programming a asp.net application consuming an Webservice hosted on Apache/Axis. I have generated WSDL and Proxy classes from VisualStudio.net. But when...
0
by: Adam Smith | last post by:
Hello. I've got a total of 5 schemas. They are: 1 - 1.xsd - a description of a city 2 - 2.xsd - a description of a town 3 - CityHall.xsd - a description of a cityhall-meant to be part of a...
1
by: Scott Dunham | last post by:
I'm trying to select records between 2 different times, but I can't seem to get Access to see anything other than the date. For instance, criteria "Between #11/12/2001 1:45:00 PM# and #11/12/2001...
1
by: Clodoaldo Pinto Neto | last post by:
Hi all, I want to have the time zone string (like 'BRT') displayed after a date-time. The date column is of the type timestamp with time zone. But the time zone is not displayed. It works for...
7
by: Jorgen Haukland, Norway | last post by:
Hi, I have created a Java webservice which runs in IBM WebSphere appserver. I take the WSDL-file and create a VS.NET WinForm application and calls the service running on my PC and everything...
1
by: Kenny Ho | last post by:
Hi, I have written the following schema that contains the XML signature: ----------------------------------------------------------------------- <?xml version="1.0" encoding="utf-8" ?>...
1
by: Moon Chung | last post by:
Hello, Has anyone used Testing Tools from WS-I (www.ws-i.org)? I am building a Web Service and hopefully it would be interoperable. When I ran Testing Tool, I am getting BP1212 error. I...
3
by: Jeremy Chapman | last post by:
I've writtin a very simple web service in axis which returns an array of classes. I consume it in a .net app. When receiving the response, my .net app generates an error "Cannot assign object...
1
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...

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.