Calendar1.value & ADOC 
Author Message
 Calendar1.value & ADOC

I am trying to update an adoc control programmatically, based on a variant
value retrieved from the Calendar control click event.  If I hard code a
date
in my sql statement, records from an Access97 table are displayed in the
grid.  However if I try to use the converted value from Calendar1.Value I
get the annoying "no value given for one or more required parameters"
message

Option Explicit

Private Sub Calendar1_Click()
Dim SQLVal As String
Dim pickedDate As Date
pickedDate = CStr(Calendar1.Value)

SQLVal = "SELECT Contacts.LastName, Contacts.FirstName, " & _
"Events.[Sched Date], Events.[Sched Time], Events.Comments " & _
"FROM Contacts, Events WHERE Contacts.ContactID = Events.ContactID " & _
"AND (Events.[Sched Date] = '12/01/00') "  NOTE:  with the hardcoded string
the adoc refreshes and the grid gets updated

SQLVal = "SELECT Contacts.LastName, Contacts.FirstName, " & _
"Events.[Sched Date], Events.[Sched Time], Events.Comments " & _
"FROM Contacts, Events WHERE Contacts.ContactID = Events.ContactID " & _
"AND (Events.[Sched Date] = pickedDate) "  NOTE:  passing the converted
calendar1.value causes the  annoying "no value given for one or      more
required parameters"  message even though the pickedDate exists in the
database.

MsgBox SQLVal
Form1.Adodc1.RecordSource = SQLVal
Form1.Adodc1.Refresh

Set Form1.DataGrid1.DataSource = Adodc1

End Sub




Wed, 21 May 2003 03:00:00 GMT  
 Calendar1.value & ADOC
Try this:
strSql="Select * From MyTable WHERE MyDateField=DateSerial('" &
Calendar1.Value & "')
Hope that helps you.

--
Ivan Rekovic


Quote:
> I am trying to update an adoc control programmatically, based on a variant
> value retrieved from the Calendar control click event.  If I hard code a
> date
> in my sql statement, records from an Access97 table are displayed in the
> grid.  However if I try to use the converted value from Calendar1.Value I
> get the annoying "no value given for one or more required parameters"
> message

> Option Explicit

> Private Sub Calendar1_Click()
> Dim SQLVal As String
> Dim pickedDate As Date
> pickedDate = CStr(Calendar1.Value)

> SQLVal = "SELECT Contacts.LastName, Contacts.FirstName, " & _
> "Events.[Sched Date], Events.[Sched Time], Events.Comments " & _
> "FROM Contacts, Events WHERE Contacts.ContactID = Events.ContactID " & _
> "AND (Events.[Sched Date] = '12/01/00') "  NOTE:  with the hardcoded
string
> the adoc refreshes and the grid gets updated

> SQLVal = "SELECT Contacts.LastName, Contacts.FirstName, " & _
> "Events.[Sched Date], Events.[Sched Time], Events.Comments " & _
> "FROM Contacts, Events WHERE Contacts.ContactID = Events.ContactID " & _
> "AND (Events.[Sched Date] = pickedDate) "  NOTE:  passing the converted
> calendar1.value causes the  annoying "no value given for one or      more
> required parameters"  message even though the pickedDate exists in the
> database.

> MsgBox SQLVal
> Form1.Adodc1.RecordSource = SQLVal
> Form1.Adodc1.Refresh

> Set Form1.DataGrid1.DataSource = Adodc1

> End Sub





Fri, 23 May 2003 03:00:00 GMT  
 Calendar1.value & ADOC

Sorry,
SQL statement must use DateValue instead DateSerial


Quote:
> Try this:
> strSql="Select * From MyTable WHERE MyDateField=DateSerial('" &
> Calendar1.Value & "')
> Hope that helps you.

> --
> Ivan Rekovic



> > I am trying to update an adoc control programmatically, based on a
variant
> > value retrieved from the Calendar control click event.  If I hard code a
> > date
> > in my sql statement, records from an Access97 table are displayed in the
> > grid.  However if I try to use the converted value from Calendar1.Value
I
> > get the annoying "no value given for one or more required parameters"
> > message

> > Option Explicit

> > Private Sub Calendar1_Click()
> > Dim SQLVal As String
> > Dim pickedDate As Date
> > pickedDate = CStr(Calendar1.Value)

> > SQLVal = "SELECT Contacts.LastName, Contacts.FirstName, " & _
> > "Events.[Sched Date], Events.[Sched Time], Events.Comments " & _
> > "FROM Contacts, Events WHERE Contacts.ContactID = Events.ContactID " & _
> > "AND (Events.[Sched Date] = '12/01/00') "  NOTE:  with the hardcoded
> string
> > the adoc refreshes and the grid gets updated

> > SQLVal = "SELECT Contacts.LastName, Contacts.FirstName, " & _
> > "Events.[Sched Date], Events.[Sched Time], Events.Comments " & _
> > "FROM Contacts, Events WHERE Contacts.ContactID = Events.ContactID " & _
> > "AND (Events.[Sched Date] = pickedDate) "  NOTE:  passing the converted
> > calendar1.value causes the  annoying "no value given for one or
more
> > required parameters"  message even though the pickedDate exists in the
> > database.

> > MsgBox SQLVal
> > Form1.Adodc1.RecordSource = SQLVal
> > Form1.Adodc1.Refresh

> > Set Form1.DataGrid1.DataSource = Adodc1

> > End Sub





Mon, 26 May 2003 07:21:14 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Calendar1.value & ADOC

2. Calendar1.value & ADOC

3. Illegal use of Null Values !^&*$@^&*^$&*

4. Getting error message when using SQL for data source in ADOC

5. VB6 ADOC control problem !!!

6. ADOC Problem

7. ADOC Data cotrol

8. *&*&*&* Date math question *&*&*&*

9. ネットゲーム オセロ, インターネットのお金を稼ぐ, オンラインゲーム&#123

10. Access Loses Default Values & Descriptions

11. special tag value &H66310102

12. Shape .Top & .Left values relative to Page

 

 
Powered by phpBB® Forum Software