By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,139 Members | 1,247 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,139 IT Pros & Developers. It's quick & easy.

Access Instant Messenger

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
"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.