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

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 6862
st**********@easthants.gov.uk (Stuart Clark) wrote in
news:55*************************@posting.google.co m:
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
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...
8
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...
13
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
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...
5
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...
4
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...
3
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
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.. ...
12
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...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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
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...

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.