1
Answer

Select current date between Start date and End date

ZULFAHMI AIDI

ZULFAHMI AIDI

14y
4.5k
1
Hi there,

I got problem in building the select query here. I try to make a daily notification system using VB.Net  and Access and notification is between the start date and end date

Example like if today(3/18/2010) in between Start Date (3/1/2010) and End Date (3/31/2010) then the notification is active and it will be false if today date is not in the between the start and end date

My table structure look like this

Table Name: Notify
Field: ID, StartDate, EndDate, Name

There were no field for today date

The query that i have try

txtCurDate.Text = DateTime.Now.ToShortDateString()

Dim cmd As New OleDbCommand("Select * from Notify  where '" & txtCurDate.Text & "' between StartDate AND EndDate ", OleDbConnection)

The error is
Syntax error in FROM clause.

can anyone help or advise me with the query

Answers (1)
0
Hirendra Sisodiya

Hirendra Sisodiya

NA 8.8k 3m 14y

use this line and try:
Dim cmd As New OleDbCommand("Select * from [Notify]  where #" & txtCurDate.Text & "# between [StartDate] AND [EndDate] ", OleDbConnection)
if you have any problem, send me your connection string....
thanks
 please check answere if you like