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

Querying table with looping date finction

2
Hello,

I am trying to do basically this, the actual SQL is much uglier but if someone can help with this I would be able to adapt it to that. Here is basically my VB:

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2.  
  3. Option Explicit
  4.  
  5. Function CreateDate()
  6. Dim strSQL As String
  7. Dim StartDate, EndDate, MyDate As Date
  8. Dim rs As DAO.Recordset
  9. StartDate = #1/1/2013#
  10. EndDate = #1/31/2013#
  11. CreateDate = StartDate
  12. While CreateDate <> EndDate
  13. CreateDate = CreateDate + 1
  14. strSQL = "Select * from Sheet1" & _
  15. "Where [Field2] = " & CreateDate
  16. Set rs = CurrentDb.OpenRecordset(strSQL)
  17. Debug.Print strSQL
  18. Wend
  19. End Function
Nick
Apr 5 '13 #1
3 941
Rabbit
12,516 Expert Mod 8TB
Please use code tags when posting code.

I don't know what your question is. As far as the title of thread, "Querying table with looping date finction", you're already doing that. So I'm not sure what it is that you're having trouble with.
Apr 5 '13 #2
ndrake
2
Thanks for the edit. I will add the code tags in the future. The problem I am having is I get an error when executing. And the debug points to rs. When I remove the rs and really just try and output a value I don't have anything returned. I will post more information tonight about the problem but that is the jist of the issue
Apr 5 '13 #3
Rabbit
12,516 Expert Mod 8TB
When you do, please post the full error message.
Apr 5 '13 #4

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

Similar topics

2
by: Rasta | last post by:
Hi, I've created a new table in a SQL Server db called 'LGBProdDetails' and I keep getting an error from my asp page that queries the table The error is: Category=Microsoft OLE DB Provider for...
4
by: Stewart Allen | last post by:
I'm trying to filter a table that has 2 date fields, the first date will always have a value but the second will only occasionally has a value. Each date field also has a corresponding text field...
2
by: Keith Crooks | last post by:
Hi guys, I have a table with a date field in the format 01/12/04 what I need in the same table is a field that just takes the month and year from the date field. I have been told how to do...
4
by: John | last post by:
Is there anyway to refer to an object's (e.g., a table) created date in VB? The reason is I need to see the data set's "date effective", which for me would be the date the table was created. I...
20
by: Eeek | last post by:
Hi, I'm relatively new to Access, in particular Queries, I need to do a query that displays all customers who havent placed an order within the last 3 months; i have the following tables...
2
by: mlevit | last post by:
Hey all, I'm trying to update a table using sql with todays date. I use this, Dim todaysDate As Date todaysDate = Date
1
by: baburk | last post by:
Is there is any possibility of getting the table creation date through Query?
1
by: ilikebirds | last post by:
I have 2 tables that are, for the sake of description, nearly Identical. The only Difference is that 1 has and the other has which are always different. Is there a way to combine the...
11
by: KashMarsh | last post by:
I added the 2 str's below. How do I add them into the SELECT INTO while still keeping the looping syntax? The field names in the table (tShipDetails) are Qty and StockID. Any help is appreciated....
4
by: Emmanuel Ayivi | last post by:
I created a table called "tblfeesdetails" with fields; "groupid", "Academic_year", "Term", "Insect_date and time" and these fields are updated base on a command button click and the update date and...
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
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: 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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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.