472,805 Members | 906 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,805 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 6846
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.