473,800 Members | 2,725 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error in BETWEEN Code for DoCmd.OpenForm

Hi,
I have the following lines of code:
stLinkCriteria = "[Acres] BETWEEN " & [SearchBox1] & " AND " &
[SearchBox2]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Every time I try and run this I get the following error:
Run-Time Error 2501
The OpenForm action was cancelled.

Can anyone tell me what I've done wrong? The code should enable the
user to enter to numerical values into textboxes SearchBox1 and
SearchBox2 and see all records where the Acre values are between those
entered.

Cheers!
Stu.
Nov 12 '05 #1
2 6878
st**********@ea sthants.gov.uk (Stuart Clark) wrote in
news:55******** *************** **@posting.goog le.com:
Hi,
I have the following lines of code:
stLinkCriteria = "[Acres] BETWEEN " & [SearchBox1] & " AND "
&
[SearchBox2]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Every time I try and run this I get the following error:
Run-Time Error 2501
The OpenForm action was cancelled.

Can anyone tell me what I've done wrong? The code should
enable the user to enter to numerical values into textboxes
SearchBox1 and SearchBox2 and see all records where the Acre
values are between those entered.

Cheers!
Stu.

The problem probably doesn't lie here, but somewhere in the form
whose name is passed in the variable stDocName. There may be some
code in that form that closes it if some criteria is not met.

Bob Q

Nov 12 '05 #2
Hi!
Thanks - I actually found the problem just after I posted the message
but didn't have time to post an update. I hadn't realised that you had
to set the field type in the table to numerical - rather dumb of me
really!
Thanks for the advice though!
Stu.
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
8839
by: JMCN | last post by:
hello i receive a runtime error '2465' whenever i run my module in access 97. it says 'Run-time error '2465' OOB Reports can't find the field "DuplicatePayments' referred to in your expression. You may have misspelled the field name or the field may have been
8
5161
by: swathky | last post by:
I've tried mutiple things but no go -- (sorry this is so long) I'm collecting a 5 digit number in an input box function and all works fine until a number is passed that doesn't exist in the database. I can't figure out where/how to check that the number exists before I get the error code 2105. Here's my function to get the number that I run when a command button is clicked to open the frmEditLoans form: Public Function...
13
6621
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
4
1933
by: Xiphias | last post by:
Hi, Hope you can help me on this... I got 1 form with a sub form. On this subform there are only parts of records, so you can select the one you want to edit. When you dubbel click that record a second form will open and you see all info of that record(also the info that was already shown on form 1) Now is it posible to edit the record.
5
744
by: Bob | last post by:
Hi Everybody I hope you can help. 2 related questions. 1. I am looking for a way to replace the confusing message box that comes up when a user trys to open a form without putting data in it. ie ..Syntax Error(Missing Operator) In queryexpression '=" & Me! DoCmd.OpenForm stDocName, , , stLinkCriteria
4
5558
by: John Baker | last post by:
Hi: I have a MACRO and as one step in it I am opening a form, which is based on a query. The query calls for entry of a portion of an associates name as the selection criteria for records. Using the form : Like & "*" The snag is that the box that comes up offers the opportunity to click on "Cancel". When the user clicks on "Cancel" (intending to stop the process) the system appears to close out totally. In other words, there is no...
3
2044
by: Smriti Dev | last post by:
Hi There, I have the following code and when I try to run it, I get a type mismatch error. I would really appreciate your help with this. Thanks kindly, smriti --- Private Sub cmdOK_Click()
1
1541
by: Smriti Dev | last post by:
Hi There, I am getting a run-time error 3800 'username' is not an index in this table. I'm not sure why I am getting this. Would really appreciate some help with it.. the code follows below.. Private Sub cmdOK_Click() Dim strMsg As String Dim varTNum As String, varPW As String Dim varSec As Byte
12
5220
imrosie
by: imrosie | last post by:
I have a listbox called 'paymnt' ; it has 2 values (check & creditcard). Just below paymnt, I have a command button called 'sendpay' . I am trying to use a Select statement in 'sendpay' based on the paymnt control. I think it can be done.. but it's not working. Can anyone see what a newbie can't? thanks so much. Here's the code: Private Sub sendpay_Click() Select Case Me.paymnt.Value Case "Check" DoCmd.OpenForm "paymntcrdtcrd" Case...
0
9690
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10274
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9085
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7576
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.