the code click after
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Access VBA Training and help » The code on click after update is fine, but when i click on the

The code on click after update is fine, but when i click on the

resolvedResolved · Urgent Priority · Version 2007

replyReply Mon 20 Dec 2010, 14:29Delegate Astley said...

Astley has attended:
Access Advanced course

The code on click after update is fine, but when i click on the


The following code is used on a button click that should display when a date is available for reservation based on the data in my tables and form. However, when I click on the button nothing happens (event) ...It doesn't even display an error message. Any reasons why this is happening?

Public Function IsAvailable(roomName As String, Optional dt As Date, Optional t As Time) As Boolean
Dim sSQL As String
Dim rs As DAO.Recordset

sSQL = "SELECT * From ScheduledVenues WHERE VENUEname = '" & roomName & "' AND scheduleDate = #" & _
dt & "# AND scheduleTIME =" & t & ";"
'Your sSQL would actually be customized according to which controls were
'populated on the form. Do that by checking if the control is Null or "", add
'criteria where the controls are not Null or "".
Set rs = Currentdb.openrecordset(sSQL)
If Not (rs.EOF And rs.BOF) Then
rs.MoveLast
rs.MoveFirst
End If

If rs.RecordCount >0 Then
'The venue is scheduled for that time and date
IsAvailable = False
Else
IsAvailable = True
End If

If Not IsMissing(dt) Then
'include dt expression in WHERE clause
End If

End Function

For upcoming training course dates see: Pricing & availability

replyReply Thu 23 Dec 2010, 12:32Trainer Nafeesa said...

RE: The code on click after update is fine, but when i click on

Hi Astley,


Thank you for your question & apologies in the delay getting back to you.

The Access VBA trainer will respond to your question as soon as possible.

Thank you for your patience.


Regards,


Nafeesa

Microsoft Office Specialist Trainer

replyReply Tue 15 Mar 2011, 12:52Trainer Stephen said...

Will be marked as resolved in 5 days

Notice: This is an automated message. Due to inactivity, this forum post will be marked as 'resolved' if there are no further responses in the next 5 days.

 

Please browse our web site to find out more about
access+course and other Microsoft training courses.

Access tip:

Design View in Relationship window

Your in the Relationship window and changes are required to be made to a Table's design.

Rather than exiting the Relationship window, if you perform a right-mouse click on the table, it opens that table up in Design view

View all Access hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard