Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

the code click after

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

ResolvedVersion 2007

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

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

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.

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Access tip:

Duplicating an Entry

To duplicate the entry press CTRL+' (apostrophe)this will copy the contents of the previous entry in the same field.
(Table view, line above) note this also works in Excel.

View all Access hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.09 secs.