473,320 Members | 2,145 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,320 software developers and data experts.

recordsource >= string in MS Access

Hi,

I was wondering if anyone could possibly help me wih this issue. I have an access database. In this database I have a massive table that I have created a query off of in order to be able to edit the data because the actual data is write protected.

I am trying to search for certain dates in the table that have been input ex. from m/d/yyyy to m/d/yyyy. I would like to run a query that would filter the results for me.

My basic assumptions would lead me to think that I can run a query as follows;

Expand|Select|Wrap|Line Numbers
  1. data1.recordsource = "Select * from [table] where (value in column) >= " & date1 & " and (value in column) <= " & date2 & ""
  2. data1.refresh
however, this is not working for me. Any ideas??

Thanks
Nov 20 '09 #1
7 2854
Dököll
2,364 Expert 2GB
Hey, thanks for adding the sample code...

I am sending over to the Access Forum for you, for added support... I have also modified your title.

Changed from "recordsource >= string" to "recordsource >= string in MS Access"

Hope you get this one pinned down.

In a bit!
Nov 21 '09 #2
missinglinq
3,532 Expert 2GB
@kbbauman
Before concerning ourselves with the mechanics of pulling the data with a query we really need to address the question of the data being "write protected." How is the data write protected? If it is truly Read-Only, at the table level, I suspect it will still be Read-Only after being pulled thru a query.

Welcome to Bytes!

Linq ;0)>
Nov 21 '09 #3
NeoPa
32,556 Expert Mod 16PB
Linq has already made the main point, but for the WHERE clause you need :
Expand|Select|Wrap|Line Numbers
  1. WHERE [FieldName] Between #m/d/yyyy# And #m/d/yyyy#
Where the two date fields are formatted as shown but contain actual values of course.

For a fuller explanation see Literal DateTimes and Their Delimiters (#).
Nov 22 '09 #4
The data is "truly" write protected..... a large database that I do not have access to change. So, I designed a query off of that table that will let me change the data, but not store the changes obviously.. Thanks for the example I will try this out and let you know if it works.
Nov 23 '09 #5
NeoPa
32,556 Expert Mod 16PB
Please do.

I also recommend strongly that you check out the link. There are issues involved there that are less than straightforward and I frequently see suggestions from members that don't take all the issues into consideration properly.
Nov 23 '09 #6
Thanks for the help issue resolved
Expand|Select|Wrap|Line Numbers
  1. Data1.RecordSource = "Select * from [table] WHERE variable = " & variable & " and [column] Between # " & date1 & " # And # " & date 2& "#"
  2. Data1.Refresh
Nov 23 '09 #7
NeoPa
32,556 Expert Mod 16PB
Please try to pay more attention when you post.
  1. There is an edit comment on your first post explaining you should be using CODE tags when posting code.
  2. The code you post should always be copied and pasted from your project. This code clearly has not, as it would never work. It's formatted quite incorrectly.
  3. From your code you certainly don't seem to have read the linked article, or have failed to grasp the contents. Dates should not be used as they come in SQL but should always be formatted specifically.
Nov 23 '09 #8

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

Similar topics

3
by: jaYPee | last post by:
I have converted access 97 to access xp project and connect the table from my sql server 2000. my problem is that when i run my report it says "Invalid SQL Statement. Check the server filter on the...
3
by: Annelies | last post by:
Hi, I want to set the recordsource of a subform to a query with this syntax : Forms!Form_patient!sub75.form.recordsource="MyQueryName" the problem is after typing sub75. I get a list of...
3
by: Bruce Dodds | last post by:
I'm trying to set a tabledef object from a form object's RecordSource in Access 97. This is the code: Public Function EditSubjectForm(ByVal frm As Form) As Boolean Dim db As Database, tbl As...
9
by: mooseshoes | last post by:
All: I'm using Access 2000 on a Windows XP platform. My goal is to use a form to gather user criteria which I will then parse into a useable SQL string. At this point I would like to open one...
1
by: Sunil Korah | last post by:
I am having some trouble with opening recordsets. I have used code more or less straight from the access help. But still I am getting some errors. I am unable to work out what exactly I am doing...
2
by: Bex | last post by:
Hi All. I'm attempting at the moment to set the recordsource of an unbound subform when i open up it's main form. My view is to have one intial form - called "Search" which has a number of...
3
by: stuart.medlin | last post by:
I have an Access 97 application that has a basic form (Transcript) and subform. The subform has a query as a recordsource that returns records from a table: SELECT DISTINCTROW Transcript.NCID,...
2
by: G Gerard | last post by:
Hello I have noticed that whenever I set a form's RecordSource property in code it launches the form's OnActivate event. In one of my application I set a form's RecordSource to zero lenght...
2
by: Tom_F | last post by:
To comp.databases.ms-access: In the VBA code behind a form, I would like to create a string variable, composed of the names of the field(s) in the primary key of the table which is the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.