473,320 Members | 2,180 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Access 2010 Instant Messenger

I am trying to create an instant messenger tool within my database,

I have created a table with the following
fields:
from (text)
to (text)
message (memo)
test right now I am just typing in yes or no

I have created an event procedure on timer (main form) so that if a record
exists in the messages table where to = reviewernumber and [test] = "no"
a form will open displaying the message.

I am new to this and I have not gotten 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
?

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Timer()
  2. If (DLookup("[to]", "messages", "[to] = [ReviewerNumber]")) And DLookup("[test]", "messages", "[test]") = "no" Then
  3. DoCmd.OpenForm "message_popup"
  4. End If
  5. End Sub
I have this running after the user logs into a form and on the form it keep the reviewnumber in a field called ReviewerNumber and in the message table it has the To field. Basically it opens any message and doesn't seem to compare the to = reviewernumber.

Not sure if this helps but the to and reviewernumber fields are text field but have a number in the field. Example is the to field would be 245 and the reviewernumber could be 245. If the to and reviewernumber field are the same then open the form.
Nov 14 '13 #1
7 3575
Rabbit
12,516 Expert Mod 8TB
That's because you're using two DLookups. They are not linked. Get rid of the second lookup and look up test in the first one instead of to.
Nov 14 '13 #2
Seth Schrock
2,965 Expert 2GB
Try something like this:

Expand|Select|Wrap|Line Numbers
  1. If DCount('*', "Messages", "To = '" & ReviewerNumber & "' and Test = 'no') > 0 Then
  2.     DoCmd.OpenForm "message_popup"
  3. End if
You actually had a couple of errors in your code. First was a syntax error in the "[to] = [ReviewerNumber]" part. You need the ReviewerNumber outside the quotes so that it sees it as a field name that has a value instead of searching for the text "ReviewerNumber" (which would need single quotes around it anyway since it is a string value). The second error was in logic. By separating your two criteria into separate DLookup functions Access doesn't know that you are looking for a record that has both a TO value of 245 and a TEST value of "no". It just looks for a record with a TO value of 245 and then searches for another record that has a TEST value of "no".

Just a suggestion, as it stands right now, as long as you have a message that was sent to you in the table, the form will open even if you have already read the message. You might want to add a field that tells you if you have read the message and then add that field to your criteria so that the form only opens if you have an unread message.
Nov 14 '13 #3
Seth, Let me first start out by saying I am a network admin and have no real experience...let me change that to no experience in access or writing code. I am just trying my best to understand everything.

What I have is a field called test and if test is no then it will open the form if [to] and [reviewernumber] are the same.

I tried your code but I am receiving a syntex error.

I might not have explain it well but I also think it can't find the reviewernumber on the form because I am not telling it to look there?
[Forms]![00 StartUp]![reviewernumber]

I am just assuming it should be able to find it because it is lauching from the form.

Sorry that I am a complete noob but I am extremly thankful for all your help
Nov 14 '13 #4
Seth Schrock
2,965 Expert 2GB
If the ReviewerNumber is on the same form that your timer is running on, then you can just reference it using Me.ReviewerNumber. If if is on a different form, then you most definitely have to reference it using the method you described.

Also, when you get the error and click OK, then it should highlight the problem. What is it highlighting?

No problem being a noob. It wasn't so long ago that I was in your same shoes and there is still plenty that I don't know. If there is something that you don't understand, just ask for clarification.
Nov 14 '13 #5
If DCount('*', "Messages", "To = '" & Number & "' and Test = 'no') > 0 Then

It doesn't like the first ' that I underlined

If DCount('*', "Messages", "To = '" & Number & "' and Test = 'no') > 0 Then

and yes number is being launched from the same form
Nov 14 '13 #6
I have a question....Does anyone have a better way of implementing instant messaging where someone logs in and they use the login number to pull instant messages from another table for that login number.

Because I think I got it to work but lol now it just opens a blank form with no information.

So yes if to = number then open form. So lol to = number but it doesn't know to open the form with that record.

I am so lost here.
Nov 14 '13 #7
zmbd
5,501 Expert Mod 4TB
Pointman: Seth, Let me first start out by saying I am a network admin and have no real experience...let me change that to no experience in access or writing code. I am just trying my best to understand everything.
If you will follow thru this tutorial MS Access 2010 Tutorials it will help tremendously with your overall understanding of the what and how of Access.

This will help keep you out of trouble should you need to upgrade Access 2007 reserved words and symbols and
AllenBrowne- Problem names and reserved words in Access

As you get a little more advanced in programing having this will be valuable in understanding why somethings happen when they do: Order of events for database objects (v2010)

and as you get time read thru the articles here (but read thru the titles, you'll find a lot of useful stuff here):Microsoft Access / VBA Insights Sitemap >> Some of these are quite dense. The trouble shooting articles are worth the time to read and will save you a headache or two.

Still looking for a good, free, online Access VBA Tutorials; however, if you follow the one above, it at least touches on things.
Oh, and look here for some other suggestions for trouble shooting > Before Posting (VBA or SQL) Code
Nov 14 '13 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: CountScubula | last post by:
Hello everyone. Ok, a lot of people here have emailed me about instant messenger, so I took some code out of a project I buit, and posted the code. You can find it here:...
2
by: Evan McPeters | last post by:
Does anyone have an example of a simple Instant Messenger program written in Python? I have some code for a simple server and simple client communicating over TCP/IP, so I could always combine...
1
by: Peter | last post by:
Hi all, I have a website where users login to and I wish to add Instant Messenger between 2 users.. for instance, clicking "IM" on someone's profile (assuming they're online of course) will...
10
by: Dee | last post by:
Is C++ the best language to create a Windows based Instant Messenger? Something along the lines of MSN Messenger, ICQ, Yahoo Chat, etc? Are there any downloadable full or trial SDK's out there?...
1
by: Mark R | last post by:
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...
0
by: Colin Tiernan | last post by:
Hi, Can someone please put me right here. I've been asked to send messages to instant messenger through my asp.net 1.1 website, as a feature of a message board that I had to hand code. I...
6
by: lalejo83 | last post by:
How do I go about starting an instant messenger in C++. pLEASE HELP ME
2
by: John Doe | last post by:
Here's my issue: I have an instant messenger type feature for my site, its basically an ajax IM feature. I run with a mysql backend on the site, i have a div on my main page that runs a javascript...
1
by: Tarren | last post by:
Hi: Are there any good c# libraries for integrating aol instant messenger capabilities into my c# code? Thanks, Tayo
4
by: jbrumbau | last post by:
Hello, In Access 2010/2007, how do you prevent users from flipping into design view from the ribbon? I do not want to hide the entire ribbon (DoCmd.ShowToolbar "Ribbon", acToolbarNo) or even the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.