Open msgbox at Time-hour

G

Guest

Hi,
I´m working with Access2003, I have a form of "clients" where I can write
"time" and "date" when I want to call back to each one. Right now, the msgbox
only appears if I have the form of that customer open on the screen, so I
have to run everyone to know if there is any call. Right now I have this

Private Sub Form_Timer()
If [hora] = TimeValue(Now()) Then
MsgBox "abrir agenda!!!!"
End If
End Sub

But what I need , is to open the msgbox even if I´ve other customer or form
on the screen. So I´m trying the following:

Dim rs As DAO.Recordset
Dim strSQL As String
strSQL = "SELECT [Clientes].[TELEFONO],[Clientes].[FECHA],
[Clientes].[HORA] "
strSQL = strSQL & "FROM [Clientes] "
strSQL = strSQL & "WHERE ((Not ([Clientes].[FECHA]) Is Null) AND (Not
([Clientes].[HORA]) Is Null))"
Set rs = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)

Do While Not rs.EOF
If rs![FECHA] = DateValue(Now()) And rs![HORA] = TimeValue(Now()) Then

MsgBox "Debe Llamar al numero " & rs![TELEFONO], vbInformation, "AGENDA
PENDIENTE"

rs.MoveNext
End If
Loop
rs.Close

But it gives me an error on: "Set rs = CurrentDb.OpenRecordset(strSQL,
dbOpenDynaset)"
I really don´t know how can I get it right. If somebody knows about, please
let me know.

Thanks
 
G

Guest

What error are you getting?

For one thing, I would change this line:
strSQL = strSQL & "WHERE ((Not ([Clientes].[FECHA]) Is Null) AND (Not
([Clientes].[HORA]) Is Null))"

To
strSQL = strSQL & "WHERE [Clientes].[FECHA]) Is Not Null AND
[Clientes].[HORA] Is Not Null;"
 
G

Guest

I have changed the line, as you mentioned, and now the error I get is (I will
translate it as better I can from spanish):

Microsoft Visual Basic
It has been produced an error '3061' on execution time:
Little (or few) parameters. Supposed to be 3

Finalized - Depurate - Help


Klatuu said:
What error are you getting?

For one thing, I would change this line:
strSQL = strSQL & "WHERE ((Not ([Clientes].[FECHA]) Is Null) AND (Not
([Clientes].[HORA]) Is Null))"

To
strSQL = strSQL & "WHERE [Clientes].[FECHA]) Is Not Null AND
[Clientes].[HORA] Is Not Null;"
--
Dave Hargis, Microsoft Access MVP


Leire said:
Hi,
I´m working with Access2003, I have a form of "clients" where I can write
"time" and "date" when I want to call back to each one. Right now, the msgbox
only appears if I have the form of that customer open on the screen, so I
have to run everyone to know if there is any call. Right now I have this

Private Sub Form_Timer()
If [hora] = TimeValue(Now()) Then
MsgBox "abrir agenda!!!!"
End If
End Sub

But what I need , is to open the msgbox even if I´ve other customer or form
on the screen. So I´m trying the following:

Dim rs As DAO.Recordset
Dim strSQL As String
strSQL = "SELECT [Clientes].[TELEFONO],[Clientes].[FECHA],
[Clientes].[HORA] "
strSQL = strSQL & "FROM [Clientes] "
strSQL = strSQL & "WHERE ((Not ([Clientes].[FECHA]) Is Null) AND (Not
([Clientes].[HORA]) Is Null))"
Set rs = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)

Do While Not rs.EOF
If rs![FECHA] = DateValue(Now()) And rs![HORA] = TimeValue(Now()) Then

MsgBox "Debe Llamar al numero " & rs![TELEFONO], vbInformation, "AGENDA
PENDIENTE"

rs.MoveNext
End If
Loop
rs.Close

But it gives me an error on: "Set rs = CurrentDb.OpenRecordset(strSQL,
dbOpenDynaset)"
I really don´t know how can I get it right. If somebody knows about, please
let me know.

Thanks
 
G

Guest

I missed removing one paren.
Try:
strSQL = strSQL & "WHERE [Clientes].[FECHA] Is Not Null AND
[Clientes].[HORA] Is Not Null;"

The error is saying the query is expecting 3 parameters.
--
Dave Hargis, Microsoft Access MVP


Leire said:
I have changed the line, as you mentioned, and now the error I get is (I will
translate it as better I can from spanish):

Microsoft Visual Basic
It has been produced an error '3061' on execution time:
Little (or few) parameters. Supposed to be 3

Finalized - Depurate - Help


Klatuu said:
What error are you getting?

For one thing, I would change this line:
strSQL = strSQL & "WHERE ((Not ([Clientes].[FECHA]) Is Null) AND (Not
([Clientes].[HORA]) Is Null))"

To
strSQL = strSQL & "WHERE [Clientes].[FECHA]) Is Not Null AND
[Clientes].[HORA] Is Not Null;"
--
Dave Hargis, Microsoft Access MVP


Leire said:
Hi,
I´m working with Access2003, I have a form of "clients" where I can write
"time" and "date" when I want to call back to each one. Right now, the msgbox
only appears if I have the form of that customer open on the screen, so I
have to run everyone to know if there is any call. Right now I have this

Private Sub Form_Timer()
If [hora] = TimeValue(Now()) Then
MsgBox "abrir agenda!!!!"
End If
End Sub

But what I need , is to open the msgbox even if I´ve other customer or form
on the screen. So I´m trying the following:

Dim rs As DAO.Recordset
Dim strSQL As String
strSQL = "SELECT [Clientes].[TELEFONO],[Clientes].[FECHA],
[Clientes].[HORA] "
strSQL = strSQL & "FROM [Clientes] "
strSQL = strSQL & "WHERE ((Not ([Clientes].[FECHA]) Is Null) AND (Not
([Clientes].[HORA]) Is Null))"
Set rs = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)

Do While Not rs.EOF
If rs![FECHA] = DateValue(Now()) And rs![HORA] = TimeValue(Now()) Then

MsgBox "Debe Llamar al numero " & rs![TELEFONO], vbInformation, "AGENDA
PENDIENTE"

rs.MoveNext
End If
Loop
rs.Close

But it gives me an error on: "Set rs = CurrentDb.OpenRecordset(strSQL,
dbOpenDynaset)"
I really don´t know how can I get it right. If somebody knows about, please
let me know.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top