Update DataControl 
Author Message
 Update DataControl

Hi!
I want to get some data from an access-db. I have connected it to a
datacontrol
and writes following code:

strDate = Date

strSQL = "SELECT * " & _
         "FROM mytable " & _
         "WHERE reminddate = strDate"

    Data1.RecordSource = strSQL
    Data1.Refresh 'this line gives an error

    Set rs = Data1.Recordset

The error says that Refresh should recieve a parameter and the help file
for Refresh cannot be displayed in MSDN. What am I doing wrong? Please help
a Newbie!



Sat, 20 Apr 2002 03:00:00 GMT  
 Update DataControl


Quote:
> strSQL = "SELECT * " & _
>          "FROM mytable " & _
>          "WHERE reminddate = strDate"
>...What am I doing wrong? Please help

If you are in the UK, I will also preempt your next question, Q. 'Why
does it get the month and the day mixed up ?'. A. You need to convert
strDate to the US format (see below).

If strDate is a string entered by the user, first convert it to a
date data type:
  If IsDate(strDate) then
    MyDate=CDate(strDate)
  else
    MsgBox "Unable to interpret the date '" & strDate & "'..."
  endif

Then do this:
           "WHERE reminddate = #" & format(MyDate,"mm/dd/yyyy") & "#"

Steve.



Sat, 20 Apr 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Requery/Update/Datacontrol ?

2. updating wrong recordset using Datacontrol?

3. DataControl..Update database type question

4. DBGrid Update from a second Datacontrol?

5. DataControl On Line Update with SQL Passthrough

6. How do I disable the auto update of the DataControl

7. ADO DataControl and updates.

8. when datacontrol.refresh after datacontrol.recordsource=sql, I get object error

9. GPFs when using DBListbox with a Datacontrol updated with SQL strings in .Recordsource.

10. Recordset Update and datacontrol Refresh - what are the differences??

11. datacontrol in vba

12. ADODC datacontrol and parameter query.

 

 
Powered by phpBB® Forum Software