Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 03-24-2010, 03:39 PM   #1
Beta Member
 
ZerŲ Coder's Avatar
 
Join Date: Mar 2010
Posts: 1
Default VBA code, Error problems

Hey there, I have written a bit of code for a coursework task.
but I'm having a problem in it throwing up the right error message.

Private Sub Form_BeforeUpdate(Cancel As Integer)

Dim MsgBoxTxt As String
Dim Places As String

Places = DCount("*", "Booking", "[Course ID] = ComboCourseID")

If DCount("*", "Booking", "[Course ID]=ComboCourseID") < 20 Then

MsgBoxTxt = "Course is Booked with " & Places & " Customers and there are " & 20 - Places & " places left."

Else
MsgBoxTxt = "Course is full with " & Places & " places taken out of 20. Sorry, this booking cannot be made."
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70

End If

If DCount("*", "Booking", "[Course ID]=ComboCourseID and [Customer ID] = FormCustomerID") >= 1 Then
MsgBoxTxt = "Customer has already booked on this course"
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
End If

MsgBox MsgBoxTxt
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70


End Sub



The error message it is showing at the moment is underlined but the one it should be showing is in bold

I would much appreciate it if someone could get back to me with an answer thank you!
ZerŲ Coder is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 11:51 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0