Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Date Range Error


I'm extracting records from an Access table with the code below. The record contains a date field that sometimes contains garbage so when I hit rs.Fields(li).Value I get an error. How do I handle that field without popping an error?

Thanks!


Set rs = New Recordset
rs.Open sSQL, oConn, adOpenStatic, adLockOptimistic

If Not (rs Is Nothing) Then
If rs.RecordCount > 0 Then
' Open the export file.
iFileNumber = FreeFile
Open sFileName For Output As #iFileNumber
While rs.EOF <> True
sLine = ""
For li = 0 To rs.Fields.Count - 1
If Len(sLine) > 0 Then
sLine = sLine & "|" & rs.Fields(li).Value
Else
sLine = rs.Fields(li).Value
End If
Next li
Print #iFileNumber, sLine
rs.MoveNext
Wend
Close #iFileNumber




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Excel Range In Variant Array, 'Subscript Out Of Range' Error
Morning Guru's

I have been having problems with this function for a few days now. I'd be most grateful if one of you could set me straight with this. Here is my code:


Code:

Private Function RemoveNulls(ByVal srcRange As Excel.Range, ByVal lastRow As Long)
MsgBox srcRange.Address

Dim i As Long
Dim xlVals() As Variant
xlVals = srcRange.Value
For i = LBound(xlVals) To UBound(xlVals)
If xlVals(i) = -9999 Then xlVals(i) = 0
Next i
srcRange.Value = xlVals
Set srcRange = Nothing
End Function


The compiller gives me the 'Subscript out of Range' error on the line:
If xlVals(i)=-9999 Then xlVals(i)=0

In-fact if I try to get a msgbox or something to display any value in the array, I get the same error. The Lbound and UBound functions are returning the expected values, therefore I believe that the array definately contains data!?

Any Ideas Amigo's?

Thanks

Generating A Date Range From Start And End Date
I'm trying to figure out how to automatically generate an array of dates from a specified start and end date in excel. For example, if the user specified two months--January 2007 through May 2007--Excel would build an array such as:

Jan-07
Feb-07
March-07
April-07
May-07

Could anyone point me in the right direction?

Thanks for your help,
Casey

How To Determine Date Group If More Than 1 Date Range?
Hi all,
Please refer to the attchment enclosed here.
i have a table of data which consists of many date.
From the date, i will refer the CLOSING table (which attached here) to determine the month for all the date.
I cannot pick the month based on normal format(date) because of the user requirement.So the month will be followed the CLOSING table.
How the SQL statement will look like?
Or if it can be done in VB, how to do it??
if u cannot give the code, the Pseudo code is enough.
Thanks in advance.

Date (How To Find If Sat N Sun In A Range Of Date)
Hi! I have two DTPicker controls. The user can pick two dates. And I want to calculate the no. of days different between the two dates WITHOUT including Sat and Sun (if the Sat n Sun is in the range). How can I possibly do that?
Thank you for any suggestion!

Validating Date Entered To Period Entered (which Corresponds To A Date Range)
I am trying to create a macro in excel that compares a date entered (YYYYMMDD) and a period entered (1-13) to see if the date entered matches the dates of the period entered?

(E.g. Date - Cell B3 = Entered 20040412 (YYYYMMDD)
        Period - Cell B4 = Entered 12
        Since period 12 respective dates are 20040404 thru 20040501 macro should return message saying valid date and period


         Date - Cell B3 = Entered 20040412
        Period - Cell B4 = Entered 11
        Since period 11 respective dates are 20040307 thru 20040402 macro should return message saying invalid - date and period do not match)


edit:: Moved to VBA (Sorry, I have no answer for you)



Edited by - Metallisoft on 4/13/2004 11:04:34 AM

Date Range
Hi,

I Have a problem with this statement

Dim DateStart As Date
Dim DateEnd As Date

DateStart = Format(txtStart.Value, "M/D/YYYY")
DateEnd = Format(txtEnd.Value, "M/D/YYYY")

frmMain.AdoDCFind(0).Recordset.Filter = "FieldName >= #" & DateStart & "#" And "FieldName <=#" & DateEnd & "#"


Error : Type mismatch


Please help. thank you

Date Range
Does anybody have a function to populate a combobox with date ranges from 2002-12,2002-11 .....2 years back starting from now.

Date Range
I have a form that allows the user to select criteria to display in a report. One of the selections is a date range. There are two text boxes:
From: [textbox1] To: [textbox2]

The date in box 1 must be less than the date in box 2 in order for the report to display the correct results. My problem is how do I put an error trap on my code so that if date1 is greater than date2, a message informing the user to correct their mistake is put up.

Here's my code so far:

Code:
strRSSql = "Select * From PR_V_RPT_OTHER " & _
"WHERE PROJECT = '" & cboCriteria(0).Text & "'"

If txtCriteria(2).Text <> "" Then
strRSSql = strRSSql & " AND RLTY_PAYMENT_MTH_YR >= '" & txtCriteria(2).Text & "'"
End If

If txtCriteria(3).Text <> "" Then
strRSSql = strRSSql & " AND RLTY_PAYMENT_MTH_YR <= '" & txtCriteria(3).Text & "'"
End If

strRSSql = strRSSql & " ORDER BY RLTY_PAYMENT_MTH_YR ASC"

Thanks!

Date Range
My client wants to set a date range and show how many parties were booked over that period. I can get the number of parties booked for one particualr day using the code below but not sure how to set up the second date to search between. Has anyone got any suggestions?? I would be using another DTPicker to select the second date.


Code:
Private Sub cmdGetSummary_Click()
Dim sName As String
Dim sSQL As String
Dim rsInformation As ADODB.Recordset
Dim strCn As String

strCn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Persist Security Info=False;" & _
"Data Source=" & App.Path & "kidsspace.mdb"

sName = DTPicker1
If Len(sName) Then
sSQL = "Select Count(*) AS res FROM Party WHERE [Date Of Party] Like '" & sName & "%'"

Set rsInformation = New ADODB.Recordset
rsInformation.Open sSQL, strCn
Text2.Text = rsInformation![res]

End If

End Sub

Date Range
how we actually doing something to get data of last 2 year
current date is 4/9/2004, but i want to get data of last 2 years?
which is the range of date should be from 12/29/2002~12/29/2004 instead of using the IN ( ....) to type the date manually. so that the next day which is 12/30/2004, the range will be automatically from 12/30/2002~12/30/2004
sql statement condition [where ...] how to write? thanks

Date Range
How do you code something to search and display a certain range of dates from an Access database? An example to get me started would be awesome. Thanks.

Date Range?
how would i get the result of date1 to date2? using a select statement. thanks

Date Range
Hi all,

Is there a way to get the dates of all weeks of a month ranging from Saturday to Wednesday?

For example:

The first working day of Feb is Sunday. So the label displays as follows:

Label1(0)--> 01-04

Label1(1)--> 07-11

Label1(2)--> 14-18

Label1(3)--> 21-25

Label1(4)--> 28-29


Please help.

Thanks

Date Range
I have an Access database and i am creating a VB program to pull the information into a form in the VB application, i want to be able to pull information based on a date range. I want to have a start date and end date. How do i create the form in vb to pull just the information between those dates i specify? I don't have a query in the database,should i?

Date Range
hi

pls any one help in this

 according to the user inputs of date i need to display all records which satisfies the user date [input] range in the flexgrid

Date Range
Hi i making a report and need to select a date range...(please help)

I have a linked Data access table (Table1)
and a main form (frmMain) with a date range (Date(0) and Date (1))
The field in the database and the report is Date.
Data is called Data and the Command is Called CmdTble1)

If anyone is able to give me any samples i would appreciate it very much

You respose is appreciated

Daniel

 

Date Range
hi

could any one help me in this regard?

i have to get the records which the records lies between the 2 user input dates.

advance thanks for your help

Date Range
Hi everyone,

I am trying to create a access database to record vacation time for employees at my company and am writing the code so that a user can enter a starting date and an ending date and all of the dates in between will be stored in a table as vacation days. Not quite sure, what the best way to do this is.

Any ideas?

Thanks for all your help.

b.

Looping Through A Date Range
I am trying to figure out exactly how to go about this but have no clue. I have 2 text boxes start date and end date. I need to loop through each date and retrieve some info from a databae on the dates. I can already get the info i need with one date.

But if I have the dates say for instance 9/25/2006 to 10/4/2006, how would I go about looping through that??

If i went something like:


Code:
Do until txtStartDate = txtEndDate
some code
loop

what do I need to do to add up, to get to the next dates and include the last date. With that statement once you get to the end date the code terminates. I hope I am some what clear, if you need any more info please ask

Adding Date Range
I currently have a date range from 7/16/75 to now. I want to have this so that there are 2 ranges...such as 7/16/75-1/15/00 and 2/1/00-now. I need to see the total elapses time by combining the two ranges. should be simple enough to add two variables for the new dates but I don't know how. Thanks in advance!!


Code:
Public Sub T() 'Calculates elapsed time

Dim Years As Integer, Months As Integer, Days As Integer
Dim StartDate As Date, EndDate As Date

StartDate = "7/16/75"
EndDate = Now

Days = DateDiff("d", StartDate, EndDate)

Years = DateDiff("yyyy", StartDate, EndDate)
If DateAdd("yyyy", Years, StartDate) > EndDate Then
Years = Years - 1
End If

Months = DateDiff("m", StartDate, EndDate)
If DateAdd("m", Months, StartDate) > EndDate Then
Months = Months - 1
End If
Months = Months - (Years * 12)

Days = DateDiff("d", DateSerial(Year(EndDate), Month(EndDate), Day(StartDate)), EndDate) + 1
If Days < 0 Then
Days = Day(DateSerial(Year(EndDate), Month(EndDate), 0)) + Days
End If
Debug.Print Years
Debug.Print Months
Debug.Print Days

End Sub

Date Range In Access
Query = "SELECT *"
Query = Query & " FROM DataAcquisition"
Query = Query & " WHERE (tDate Between #" & StartDate & "# And #" & EndDate & "#)"
Query = Query & " ORDER BY SerialNumber"

This statement is selecting all dates between StartDate and Enddate.

Can anyone see any syntax errors? If not, does anyone have any suggestions. My first guess is that tDate isn't a Date field, but I don't have authority to the Access table, so haven't been able to verify.

Any thoughts?
I thank you in advance.

Selecting A Range Of Date
VB6 Enterprise Edition

I have an Access database - the table is called TRACKING, is described:

Code:
dbTrackPercent - currency
dbTrackPONumber - Text(10)
dbTrackPODate - Text(10)
Note: I can not change the dbTrackPODate field to type-Date

I need to SELECT records within a RANGE of dbTrackPODate.

I have tried the following:

Code:
Public StartDate As String
Public EndDate As String
StartDate and EndDate are populated via an InputBox

Code:
SQL = "Select * from Tracking where dbTrackPODate "
SQL = SQL & "between '" & StartDate & "' and '"
SQL = SQL & EndDate & "' order by dbTrackPODate;"
I have also tried:

Code:
SQL = "Select * from Tracking where dbTrackPODate "
SQL = SQL & "dbTrackPODate >= '" & StartDate & "' and "
SQL = SQL & "dbTrackPODate <= '"& "' EndDate & "order by dbTrackPODate;"
Via the Input box, I entered:
12/01/2005 (StartDate)
12/31/2005(EndDate)
Both code examples gave me dates for December 2004 and 2005. I just wanted 2005.

Any suggestions on how I can code this to get the correct results?

Query Date Range
How can I show records in my Access 2000 database where a job is submitted and it stays in the query for only 7 days.
Basically it will expire and not show in my query 7 Days after the EntryDate.

For example my field name called entryDate would be the date of entry for the job:


Code:
ID Name EntryDate
1 JobOne 8/01/2004
2 JobTwo 8/20/2004
3 JobThree 8/24/2004
4 JobFour 8/14/2004
5 JobFive 8/19/2004
Only jobs that were 7 days or less old would show up in my Query results.
The below will output for todays date (8/24/2004):

Code:
2 JobTwo 8/20/2004 -->Expires on 8/27/2004
3 JobThree 8/24/2004 -->Expires on 8/31/2004
5 JobFive 8/19/2004 -->Expires on 8/26/2004
These jobs will not show in the query because they are older than 7 days after the entryDate

Code:
1 JobOne 8/01/2004 -->Expired on 8/08/2004
4 JobFour 8/14/2004 -->Expired on 8/21/2004


My attempt at this query is not working:

Code:
select * from myTable
where entryDate > Date()+7

Please advise.

Problem With SQL Date Range
Hi

I am using Access 2000, and I am trying to write a SQL string but I can't work out how to do it. The problem is, I need to take an input range of dates and apply some math to it, but I can't work out how to do it for a range of dates.

For a single date an example would be:

SELECT
date,
(((field1/(SELECT (field1 FROM tbl1 WHERE date = #01/01/04#) - 1) * 100)
FROM tbl1 WHERE date = #01/01/04#

How do I write this query so that it will work on each of a range of dates?

Thank you

Date Range Search
I can't seem to figure out a way to search the MS Access DB for dates that occure between certain dates on any year, here is an example of what I am trying now.

Dim selectstring As String
Dim row, datrow() As DataRow
selectstring = "DoRec >= #" & "3/1/**" & "#" & " and DoRec" & " <= #3/10/**#"
TextBox21.Text = selectstring
datrow = ClientsDS1.Clients.Select(selectstring, "Name")
ListBox1.Items.Clear()
For Each row In datrow
ListBox1.Items.Add(row.item("Name"))
Next

any help would be very apriciated

Date Range From Comboboxes
Hello
I’m using VB 6 as a front end to Access 03 database to populate the MSChart control.
Everything loads up fine but now I’m trying to develop a feature to display a date range of data.

I have two comboboxes that the user chooses a starting and ending date from. They load up fine and I can pick the dates just fine. And, it will display a single week of data if the starting and ending date is the same in the comboboxes.

Problem is when I choose a range I get my msgbox saying "Dates do not have any available data". Weeks is my column from the db that I want to choose from.

Code:
Private Sub DateRange()

' Close the record set if open
If rs.State <> adStateClosed Then
rs.Close
End If

' Find the range of chart data
Set cmd.ActiveConnection = cn
cmd.CommandText = "SELECT * FROM tbliface WHERE [Weeks] = #" & cboSearch.Text & "#" _
& " And [Weeks] = #" & cboEnd.Text & "#" _
& " ORDER BY [Weeks]"

rs.CursorLocation = adUseClient
rs.Open cmd, , adOpenStatic, adLockBatchOptimistic

If rs.RecordCount = 0 Then
MsgBox "Dates do not have any available data"
Exit Sub
End If

rs.MoveFirst
Set MSChart1.DataSource = rs
MSChart1.Refresh

End Sub


Thanks for any help
Steve

Get Range Date Picker
I used date picker to query. How I can get list of date in the listview when I want to query between two date in the listview from 10/01/2007 to 13/2/2007 ?


Code:

Public condatabaseSPAD As ADODB.Connection
Public spadtable As ADODB.Recordset

Public Sub SPAD()
Set condatabaseSPAD = New ADODB.Connection
Set spadtable = New ADODB.Recordset

condatabaseSPAD.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "DBMS.mdb" & ";Jet OLEDB:Database Password=macres;"
spadtable.Open "Select * from SPAD order by id asc", condatabaseSPAD, adOpenDynamic, adLockOptimistic
End Sub

Date Range Query
Hi
In my SQL table, I've one field DateTime.I wrote a date range query to retreive the data between selected date.
I'm filing the datetime field in this format.
03/06/2007 11:23:52 AM
Query:
SELECT *
FROM <tablename>
WHERE (LEFT(DateTime, 10) >= '30/05/2007') AND (LEFT(DateTime, 10) <= '05/06/2007')

No err and no result

Date Range Query
I use Microsoft Access and DTPicker..

I have START_DATE field and END_DATE Field. I want to query a date range between START_DATE and End Date using DTPicker and show it at listview.I use data type as text for both field in the table. The table name is 'kerja' For example

START_DATE

28/3/2007 Format ("dd/MM/yyyy")

End Date

3/4/2007 Format ("dd/MM/yyyy")

Date I want to query using DTPicker is 2/4/2007. It suppose to list me the one date record in the listview by finding the date range between START_DATE and End Date field.This is because no one record that range between 28/3/2007 to 3/4/2007

I have date record in start_date and end_date record.

I have problem to do a query using DTPIcker.

Code:
sql = "Select * from kerja where start_date between #" & DTPicker2 & "# and end_date"
rec.Open sql, con, adOpenDynamic, adLockOptimistic


But when I try, it list all record did not in the range.It suppose to list one record like this

HTML Code:

Start date end date peruntukan
28/3/2007 3/04/2007 7


The full record for date range query (Picture on the right)


Code:
Private Sub Command1_Click()
lvJadual1.ListItems.Clear

Dim newDate As Date
Dim newDate1 As Date

Dim sql As String



Call OpenConnection



rec.Close

sql = "Select * from kerja where start_date between #" & DTPicker2 & "# and end_date"
rec.Open sql, con, adOpenDynamic, adLockOptimistic

rec.MoveFirst

Do Until rec.EOF

Set lvItem = lvJadual1.ListItems.Add(, , "" & rec("start_date"))

lvItem.ListSubItems.Add , , "" & rec("end_date")
lvItem.ListSubItems.Add , , "" & rec("peruntukan")
lvItem.ListSubItems.Add , , "" & rec("aktiviti")
lvItem.ListSubItems.Add , , "" & rec("sasaran")
lvItem.ListSubItems.Add , , "" & rec("jenisinput")
lvItem.ListSubItems.Add , , "" & rec("tindakan")


rec.Update

rec.MoveNext
Loop


The full record from data source that use listview (picture on the left)


HTML Code:
Public Sub AddLvItem()
On Error Resume Next
Dim newDate As Date
Dim newDate1 As Date
rec.MoveFirst
Do Until rec.EOF
If rec("hari") = "" Then


Set lvItem = lvJadual.ListItems.Add(, , "")
lvItem.ListSubItems.Add , , "" & rec("end_date")
lvItem.ListSubItems.Add , , "" & rec("peruntukan")
lvItem.ListSubItems.Add , , "" & rec("aktiviti")
lvItem.ListSubItems.Add , , "" & rec("sasaran")
lvItem.ListSubItems.Add , , "" & rec("jenisinput")
lvItem.ListSubItems.Add , , "" & rec("tindakan")
'lvItem.ListSubItems.Add , , "" & rec("hari")

'Isnull(rec("hari")) ialah test untuk tengo kalau nilai yang dibaca dpd field hari ialah null atau kosong
ElseIf IsNull(rec("hari")) Then



Set lvItem = lvJadual.ListItems.Add(, , "")
lvItem.ListSubItems.Add , , "" & rec("end_date")
lvItem.ListSubItems.Add , , "" & rec("peruntukan")
lvItem.ListSubItems.Add , , "" & rec("aktiviti")
lvItem.ListSubItems.Add , , "" & rec("sasaran")
lvItem.ListSubItems.Add , , "" & rec("jenisinput")
lvItem.ListSubItems.Add , , "" & rec("tindakan")
'lvItem.ListSubItems.Add , , "" & rec("hari")
Else
newDate = DateAdd("d", rec("hari"), DTPicker1)

rec("start_date") = Format(newDate, "dd/MM/yyyy")
'newDate1 = DateAdd("d", rec("peruntukan") - 1, rec("start_date"))
newDate1 = DateAdd("d", rec("peruntukan") - 1, newDate)

rec("end_date") = Format(newDate1, "dd/MM/yyyy")


Set lvItem = lvJadual.ListItems.Add(, , "" & Format(newDate, "dd/MM/yyyy"))
lvItem.ListSubItems.Add , , "" & rec("end_date")
lvItem.ListSubItems.Add , , "" & rec("peruntukan")
lvItem.ListSubItems.Add , , "" & rec("aktiviti")
lvItem.ListSubItems.Add , , "" & rec("sasaran")
lvItem.ListSubItems.Add , , "" & rec("jenisinput")
lvItem.ListSubItems.Add , , "" & rec("tindakan")
rec.Update
End If
rec.MoveNext
Loop

Query For Date Range ???
Hi everybody !

I need to extract from a database all project between two dates ???

Here the code (sorry some words are in french):

Note: The two dates in query are for the test, in the future I will use two variables...


Code:
'Instanciation des variables
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset

'Connection Database
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & dsNonConfMDB
cn.Open

'Création de la requête
strSQL = "SELECT * FROM Data WHERE Date BETWEEN 20-08-2006 and 20-09-2006"
rs.Open strSQL, cn, adOpenKeyset, adLockPessimistic, adCmdText

'Vérifier si résultat trouvé par la requête
With rs
If Not .EOF Then 'Numéro existant
.MoveFirst
Debug.Print .Fields("ID").Value
Else
MsgBox "Aucune donnée !"
End If
End With

'Fermeture de la connection ADO
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing


Thanks in advance !

PS: Sorry I put my thread in the bad forum, is someone could move it to Database Development, thanks...

Help In Getting The Date Range Using Msaccess And Vb6
we are currently developing a system on sales.. i need to get the sales report based on date range.. please help me provide the code to get the date range using msaccess and vb6? tnx..

Help With Code (date Range)
hi.

i was successful in showing dates that are LESS THAN or later than the date today. i used this code


VB Code:
Set rsProject = dbSSS.OpenRecordset("SELECT * FROM Project WHERE DateFinish < #" & Date & "#  ;  ")


now, im trying to show data from a certain range of date.
ex. showing data that has DateFinish GREATER THAN Date1 BUT LESS THAN Date 2. i tried this but it doesn't work


VB Code:
Set rsProject = dbSSS.OpenRecordset("SELECT * FROM Project WHERE DateFinish < #" & Text2.Text & "#  > #" & Text1.Text & "#;  ")


text1 and text2 are dates.. (date1 and date2)

can someone help me? pls? thanks a lot guys.

How To Show Date Range
hi.

how can i show data from my db that have dates less than today?
i will show the data using flex grid.

i used bothe of these codes but the program doesn't recognize the "DateFinish" (a record in my table) as date?

i tried using these codes..


VB Code:
Set rsProject = dbSSS.OpenRecordset("Select * from Project where DateFinish < '" & strdate & "*'") and this Set rsProject = dbSSS.OpenRecordset("SELECT * FROM PROJECT WHERE #" & Cdate(txtSearch.Text) & "# > #" & Date & "#") FillGrid ' to show the data in grid  




can u help me guys? thanks a lot

.

For/Next Date Range Problems
I have a piece of code to loop through dates in a range & populate a charting object :

For tempdate = rs![Start] to rs![End]

Next tempdate

definitions :

tempdate as date
Start/End are from Access '97 table - and are type date/time, format General Date

if Start is set to 23/09/02 10:01:00 , End is 25/09/02 09:31:00
first pass then tempdate is set to Start value
2nd pass tempdate is 24/09/02 10:01:00
3rd pass tempdate is 25/09/02 10:01:00
& therefore drops out of loop
How do I get tempdate to take the actual end time as I need to populate the chart for end of range also.

Date In Range Function
Can anyone give me a function that will tell me if a certain date is in the range of another two dates?
It sounds a simple task, but I can't manage to do it.

Problem With Date Range
I'm bringing back dates from a database and want to compare those dates to see if they're between a range defined by two dtPickers. I've tried using >= and <= but it doesn't seem to work for dates. I was testing to see if the dates were equal and that worked fine, although it may have been testing to see if the strings were the same. So...how do I compare a date returned from the database tosee if it's between two user-defined dates? Thanks in advance.

Date Range Problem
From Andy,

I have a small problem. My problem is I am extracting Data within a specified Date range, but the Output is not as expected. i.e. no records are selected.

This is the syntax that I used :-
mfromdate contains '01/01/2000' mTodate contains '01/02/2000'

dim m_cond as string , mfromdate as Variant, mtodate as variant
m_cond = m_cond + IIf(rangeClick.Value = 1, " Install.Install_dt Between cdate('" & mFromDate & "') and cdate('" & mToDate & "') ", "")


sqlString = "Insert into InstallReport "
sqlString = sqlString + "Select Install.Install_no, Install.Install_dt, "
sqlString = sqlString + "Install.Cust_id, Customer.Name,Install.site_name,Install.inv_no,Install.inv_dt,Dsp_dtl.model_cd,Dsp_dtl.value "
sqlString = sqlString + "from (Install inner join Customer on Install.cust_id = Customer.cust_id) left join Dsp_dtl ON Install.inv_no = Dsp_Dtl.inv_no "
sqlString = sqlString +"where Install.Install_Status = 'P' and "
sqlString = sqlString + m_cond + ";"
db.Execute sqlString

When I execute the Sql it does not show any records, whereas it has to
show 1 record which satisfies the condition.

Please help me Out with this Problem

regards,

AndyR. Rego

Display Date Range
I tried the following formula while passing the two values from the datetimepicker to the crystal report.
crystalreportviewer1.selectionformula = " {tabletest.tdate} in Datetime (" & DateTimePicker1.Text & ") to Datetime (" & DateTimePicker2.Text & ")"
But it gives me a message that says "a date-time is required" i tried many things but in vain. i wonder may be its the datetime data type in MS access or wats wrong with my code. I used date/time datatype in access for the tdate field.
How do i get the dates range to be displayed in the crystal reports... PLZZZZZZZ help me,ive trying this for weeks.
Your help will be my blessing.
Thanking you in advance
for your infomation, i am using MS access and VB.net 2003.

Out Of Range Date Time Value
hi all
when I try to insert data into table (including date) I get a message simmilar to this :
the conversion of char data type to datetime data type resulted in an out of range datetime value.
P.S: I`m using the DTPicker to choose date,,,
thanx a lot

MonthView Date Range In VB
How can I get the date range that I select in the MonthView control?  It only seems to return the first date in the range.

Swi

How To Select Date Range In VB ???
Hi! I need to add Date Range Selection to our corporate tool. 2 DTPickers are not good enough
I found XE-Date Control on
http://www.xe-soft.com

It is pretty good, but probably someone knows better solution ?

Date Range Query
Hi All,

This is a problem pertaining SQL Server.

I am having a problem executing a sql query. I need to find out all the records lying between two dates, including those two days.

Here's my query:

Code:
SET DATEFORMAT DMY SELECT * FROM librarylog WHERE dttime >= '23/9/2004' AND dttime <= '25/09/2004'


The problem here is that, the field "dttime" stores values as ex: "2004-09-23 10:32:37.000" in the database. It is of type DATETIME. When i do "SET DATEFORMAT DMY" in the begining of the query, it seems to apply to only the first value and doesn't apply to the second date value in the query. as a result the query doesn't show any values for date : 25/9/2004... and shows all the values from 23rd onwards & upwards but not 25th....

please help me with this. this is a strange problem as always with me...

thanks,
Sim

SQL Date-Range Troubles
I am trying to query my database based on many things, including the date. I want to specify a certain month, and retrive records. Here is the SQL statement I am currently using:

Code:SELECT Events.EventID, Events.Date, Events.Venue, Events.Act, Venues.VenueName, Acts.ActName FROM Events INNER JOIN Acts ON Events.Act = Acts.ActID INNER JOIN Venues ON Events.Venue = Venues.VenueID WHERE (Events.Venue = " & idVenue & " AND Events.Date BETWEEN '" & fpCalendar.Month & "/1/" & fpCalendar.Year & "' AND '" & fpCalendar.Month & "/31/" & fpCalendar.Year & "')"

The trouble I am having is in the WHERE clause, using the BETWEEN operator. If I give it a month that has less than 31 days, I get a SQL datatype conversion error. I am assuming it is checking for invalid date ranges, such as like September 31 (which only has 30 days). Is there any way to circumvent this? The Events.Date Field is a datetime datatype. Is there anyway to just compare the month and year, without having to specify the day? Any help is appreciated.


 Overspecialize and you breed in weakness.

Edited by - Zargon23 on 7/30/2002 2:43:07 PM

Calculate Date's Within A Range
I am new to VB but have experience in other languages so please forgive me if this is a newbie question.

I am trying to create a macro that will search for a code integer within column A. Then for all code integers of the specified value found i need to perform a check against Date values held adjacent in column B. From the most recent entry in the list produce by this search I need to highlight any entries within the last 12 months.

Code        Date
1        12/05/03
4        14/05/03
1        29/05/03
3        05/06/03
1        23/08/03
1        29/05/04

any ideas that can just give me a starting point with this would also be appreciated.

Ragards

Lee

Date Range Search
I've read through many of the questions already posted - still not working.

I want to search my database for dates within a range
using an SQL 'Between' statement.
Everything seems to work fine, except it does not pull
up the proper date or records.

My form uses a textbox, the database is set to Text.
When database is set to "Date/Time" it does not work at all, type mismatch.
Dates in textbox and database are: (1/1/99 short date format)

To pull up one specific date such as 2/7/98 - works fine.

If I hard code the dates such as 2/7/98 through 2/7/99 -
again it does not pull up proper records.

I feel the problem lies in the fact that
the dates are not being recognized as dates, but possibly strings.

I don't get the date thing, Any suggestions ?

Thanks Russ

Checking Date Range
I want to make a small dialog box which contains
"From Date" and "To Date" input user fields .
I need to validate that the dates inserted by the user are correct.
Is there any code around that do somthing similar?

Print Data Between A Date Range
I have a data base with a long list of enteries which I would like to beable to use a macro to print enteries between to dates. If having it print is to hard how do I get to copy the enteries between the dates to a new worksheet

Finding The Range Matching A Date...
Hello!
I have a problem with finding the range which matches the date the user write in from an userform.

In column A, there is a lot of dates like this:
2007-01-01 00.00
2007-01-01 01.00
2007-01-01 02.00
....
2007-01-02 00.00
2007-01-02 01.00
...

etc

I want to write a macro that makes a chart regarding the particular day that user write in from the userform. The user will not write in the time, only the date.

How can i write the macro that find the correct range?

Please help me!

Please! Help Me To Find Something To Select Date Range In VB!
I need to add possibility to select date range on the form. 2 DTPickers are not too good.

Copyright © 2005-08 www.BigResource.com, All rights reserved