UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Checking combo box    
 
   
ltnp
post Dec 24 2008, 05:37 PM
Post #1

UtterAccess Member
Posts: 41



Hello!

I have a code below, but when I want to delete the value in the combo box I recieve an error message. I have tried to use the following code:

Dim intNoSoFar As Integer
intNoSoFar = DCount("*", "DanhSach", "Phong = " & Me.Phong)
If intNoSoFar <= 0 Then
Cancel = False
ElseIf intNoSoFar >= Me.Phong.Column(3) Then
MsgBox "The limit for your chosen room has been exceeded", vbOKOnly + vbCritical, "Limit Warning"
Cancel = True
End If

When I want to delete the value inside I recieve the following error message: "Run-time error '3075'. Syntax error (missing operator) in query expression..

What i wrong with the code?

Regards
ltnp
Go to the top of the page
 
+
jwhite
post Dec 24 2008, 06:04 PM
Post #2

UtterAccess VIP
Posts: 4,622
From: North Carolina, USA



Wrap everything after Dim and after End if in an IF block to check if there is a value first:

If Len(Me!Phong & "") > 0 Then
... the code you posted above -- Dim goes outside and above...
End If
Go to the top of the page
 
+
ltnp
post Dec 24 2008, 08:27 PM
Post #3

UtterAccess Member
Posts: 41



Thank you!

Best regards
Ltnp!
Go to the top of the page
 
+
jwhite
post Dec 24 2008, 08:35 PM
Post #4

UtterAccess VIP
Posts: 4,622
From: North Carolina, USA



(IMG:http://www.utteraccess.com/forum/style_emoticons/default/thumbup.gif)
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 19th June 2013 - 09:10 PM