468,119 Members | 1,809 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,119 developers. It's quick & easy.

Access Instant Messenger

Hi All,
I am trying to create an instant messenger tool within the database,
mainly so messages can be left for colleagues on different shifts (not all
of them have a mail account). I have created a table with the following
fields:
from (text) default value = username obtained from module which gets unique
network username
to (text)
sent (date/time) default value = now()
message (memo)
received (yes/no)

I have created an event procedure on timer (main form) so that if a record
exists in the messages table where [from] = current user and [received] =
false a form will open displaying the message.

I am new to this and I have not got the procedure right. If a message exists
where I am not the desired recipient, the form still opens.
Could anyone tell me where I am going wrong?

Private Sub Form_Timer()
If (DLookup("[to]", "messages", "[to]") = (Me!current_user.Value) & _
DLookup("[received]", "messages", "[received]") = False) Then
DoCmd.OpenForm "message_popup"
End If
End Sub

TIA,

Mark
Nov 13 '05 #1
1 4535
"Mark R" <ma*********@ntlworld.com> wrote in message news:<7e**************@newsfe1-gui.ntli.net>...
Hi All,
I am trying to create an instant messenger tool within the database,
mainly so messages can be left for colleagues on different shifts (not all
of them have a mail account). I have created a table with the following
fields:
from (text) default value = username obtained from module which gets unique
network username
to (text)
sent (date/time) default value = now()
message (memo)
received (yes/no)

I have created an event procedure on timer (main form) so that if a record
exists in the messages table where [from] = current user and [received] =
false a form will open displaying the message.

I am new to this and I have not got the procedure right. If a message exists
where I am not the desired recipient, the form still opens.
Could anyone tell me where I am going wrong?

Private Sub Form_Timer()
If (DLookup("[to]", "messages", "[to]") = (Me!current_user.Value) & _
DLookup("[received]", "messages", "[received]") = False) Then
DoCmd.OpenForm "message_popup"
End If
End Sub

TIA,

Mark

Mark,
Your syntax is a little off on the DLookUp
The equals sign goes inside the quotes with the field name
Put the value you are comparing inside the parens
If (DLookup("[to]", "messages", "[to] = " & Me!current_user.Value)) then
Hank Reed
Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by CountScubula | last post: by
2 posts views Thread by Evan McPeters | last post: by
10 posts views Thread by Dee | last post: by
reply views Thread by Colin Tiernan | last post: by
reply views Thread by Dean Sharp | last post: by
2 posts views Thread by John Doe | last post: by
1 post views Thread by Tarren | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.