the code click after

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

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

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:

Hiding rows and columns

To hide a column or row in Access, you need to minimise the column or row. This can be done by placing your mouse on the right edge of a column, wait for the mouse to change to a double aroow and then drag to minimise the column

View all Access hints and tips


Server loaded in 0.07 secs.