473,322 Members | 1,781 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,322 software developers and data experts.

coding issue

8
Form frmInfo with a subform frmAppointment. I want to check to see that all appointments have a complete date before I allow the user to check complete on a check box on the main form. My code (which was written by someone else) is as follows. I am getting error 2001 you canceled the previous operation. I am unable to figure out why. The references are all correct. If anyone can see whats wrong and help me with it, it would be greatly appreciated.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Complete_BeforeUpdate(Cancel As Integer)
  2. Dim varIncompleteProject As Variant
  3.    varIncompleteProject = (DLookup("[AppID]", "tblAppointment", _
  4.    "[ConsultNumber]= """ & Me.ConsultNumber & _
  5.    """ And[CompletedDate] Is Null"))
  6.  If Not IsNull(varIncompleteProject) Then
  7.     MsgBox "Appointment " & varIncompleteProject & " Is Not Competed"
  8.     Cancel = True
  9.  End If
  10.  
  11. End Sub
Jul 7 '08 #1
4 1313
RuralGuy
375 Expert 256MB
Try:
Expand|Select|Wrap|Line Numbers
  1. varIncompleteProject = DLookup("[AppID]", "tblAppointment", _
  2. "[ConsultNumber]= '" & Me.ConsultNumber & _
  3. "' And IsNull([CompletedDate])")
...If [ConsultNumber] is a Text field.
Jul 7 '08 #2
pfm721
8
Almost there I think, no I am getting a syntax error. The code now reads
Expand|Select|Wrap|Line Numbers
  1. Dim varIncompleteProject As Variant
  2.     varIncompleteProject = DLookup("[AppID]", "tblAppointment", _
  3.     "[ConsultNumber]= " & Me.ConsultNumber & _
  4.     "' And IsNull[CompletedDate]")
  5.   If Not IsNull(varIncompleteProject) Then
  6.     MsgBox "Appointment " & varIncompleteProject & " Is Not Competed"
  7.     Cancel = True
  8.   End If
Now the error is 3075
Syntax error in strintg in query expression '[ConsultNumer]= 1234567'
And IsNull[CompletedDate]'.

with 1234567 being the consult number and yes consult number is a text field.

Thanks
Jul 7 '08 #3
Stewart Ross
2,545 Expert Mod 2GB
Hi. You are so nearly correct now. When referring to string literals, use single quotes to enclose the string value:...
Expand|Select|Wrap|Line Numbers
  1. "[ConsultNumber]= '" & Me.ConsultNumber & "'" _
-Stewart
Jul 8 '08 #4
NeoPa
32,556 Expert Mod 16PB
Check out Quotes (') and Double-Quotes (") - Where and When to use them.
Jul 9 '08 #5

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

Similar topics

144
by: Natt Serrasalmus | last post by:
After years of operating without any coding standards whatsoever, the company that I recently started working for has decided that it might be a good idea to have some. I'm involved in this...
4
by: Josh Golden | last post by:
i lead a small development team (based on some of my posts that might cause some people to choke themselves, but have no fear, i am NOT the lead developer, the people on my team are great - i'm...
7
by: Jim Michaels | last post by:
This is a simple coding tip I learned to prevent comparisons from becoming assignments (and this becoming a hair-pulling session during debugging): in comparisons, try to put your constants on...
13
by: benben | last post by:
Is there an effort to unify the c++ coding standard? Especially identifier naming. Not a big issue but it would be annoying to have to incorporate different coding styles simultaneously when...
4
by: Brent | last post by:
I am having a problem with the coding of my website and I am very inexperienced with PHP. When using my web browser to go to my site. I notice that none of my images are appearing and any link that...
7
by: Mark | last post by:
Hi, I am creating application in VB 2005. and when I print report it adds extra 0.45 cm margin on left and top, and the reason for this is physical margins of printer. Is it possible to change...
17
by: M.Siler | last post by:
I'm trying to get my head around a conversation I had with a developer the other day. We were talking about Codesmith vs. Hand coding. He's position is Codesmith is for junior to mid level...
7
by: Robert Seacord | last post by:
The CERT/CC has just deployed a new web site dedicated to developing secure coding standards for the C programming language, C++, and eventually other programming language. We have already...
23
by: LayneMitch via WebmasterKB.com | last post by:
Hello. It's me again with another question that should generate a lot of responses. As mentioned before, I'm working on my first site (hopefully I'll be done soon and can move on to other...
4
by: gentsquash | last post by:
On some of my course pages, I quote (with attribution) small sections of Wikipedia and the like. E.g, the top of http://en.wiktionary.org/wiki/entropy has "entropia" in Greek font, ...
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...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.