473,785 Members | 2,798 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Double Bookings

I use Access 2000 and I'm trying to figure out what VBA code to use to
prevent double bookings. Any help on this matter will be greatly
appreciated. Regards Immy

Apr 3 '07 #1
6 2556
On Apr 3, 5:35 pm, iazah...@hotmai l.com wrote:
I use Access 2000 and I'm trying to figure out what VBA code to use to
prevent double bookings. The system I am trying to creating is a booking system for a car park.
Any help on this matter will be greatly
appreciated. Regards Immy
Apr 3 '07 #2
Define "double booking". Show the structure of tables. Show sample
input with expected output. Here's some vba that may (probably
not...) help.

public sub JasonsSolution( )
msgbox "Give more information!"
end sub

I know it doesn't work but it's the best I could come up with such
limited information.

After you give more info you could be helped.

Cheers,
Jason Lepack

On Apr 3, 12:35 pm, iazah...@hotmai l.com wrote:
I use Access 2000 and I'm trying to figure out what VBA code to use to
prevent double bookings. Any help on this matter will be greatly
appreciated. Regards Immy

Apr 3 '07 #3
On Apr 3, 5:41 pm, "Immy" <iazah...@hotma il.comwrote:
On Apr 3, 5:35 pm, iazah...@hotmai l.com wrote:
I use Access 2000 and I'm trying to figure out what VBA code to use to
prevent double bookings. The system I am trying to creating is a booking system for a car park.

Any help on this matter will be greatly
appreciated. Regards Immy- Hide quoted text -

- Show quoted text -
I would also like to add that the problem I keep having is how to
prevent two people from booking the same parking space on the same
date. Immy
Apr 3 '07 #4
On Apr 3, 5:43 pm, "Jason Lepack" <jlep...@gmail. comwrote:
Define "double booking". Show the structure of tables. Show sample
input with expected output. Here's some vba that may (probably
not...) help.

public sub JasonsSolution( )
msgbox "Give more information!"
end sub

I know it doesn't work but it's the best I could come up with such
limited information.

After you give more info you could be helped.

Cheers,
Jason Lepack

On Apr 3, 12:35 pm, iazah...@hotmai l.com wrote:
I use Access 2000 and I'm trying to figure out what VBA code to use to
prevent double bookings. Any help on this matter will be greatly
appreciated. Regards Immy- Hide quoted text -

- Show quoted text -
Tables are as follows
Customer
- No.
Title, First Name, Surname, House No, Street, Town,
County, Post Code, tel no.
Boat
-No.
-Name
Parking Space
- no. and Location
Bookings
No, Cust no, Boat No, Parking Space no, Date from and
Date to.

Is this of any help?

Apr 3 '07 #5
On Apr 3, 5:43 pm, "Jason Lepack" <jlep...@gmail. comwrote:
Define "double booking". Show the structure of tables. Show sample
input with expected output. Here's some vba that may (probably
not...) help.

public sub JasonsSolution( )
msgbox "Give more information!"
end sub

I know it doesn't work but it's the best I could come up with such
limited information.

After you give more info you could be helped.

Cheers,
Jason Lepack

On Apr 3, 12:35 pm, iazah...@hotmai l.com wrote:
I use Access 2000 and I'm trying to figure out what VBA code to use to
prevent double bookings. Any help on this matter will be greatly
appreciated. Regards Immy- Hide quoted text -

- Show quoted text -
This is the code I'm using at the min and it dont work:
Private Sub Command26_Click ()
On Error GoTo Err_Command26_C lick

Dim strSQL As String
Dim intCount As Integer
strSQL = "[Parking Space No] = " & [Parking Space No] & "" _
& "AND [DateFrom] = #" & [DateFrom] & "#" _
& "AND [DateTo] = #" & [DateTo] & "#"
intCount = DCount("[Parking Space No]", "Parking Space", strSQL)

If intCount = 0 Then 'slot is free
DoCmd.DoMenuIte m acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
cmdNew.SetFocus
' Command26.Enabl ed = False
Calendar2.Enabl ed = False
myDisplayInfoMe ssage = "Booking Confirmed"

Else
myDisplayWarnin gMessage = "This has already been booked" & vbCrLf
_
& "Please choose another"

End If

Exit_Command26_ Click:
Exit Sub

Err_Command26_C lick:
MsgBox Err.Description
Resume Exit_Command26_ Click

End Sub

Apr 3 '07 #6
'Try this instead:

Private Sub Command26_Click ()
On Error GoTo Err_Command26_C lick

Dim strSQL As String
Dim intCount As Integer
Dim rs As Recordset

' This gets a count of all records in Bookings that have the given
parking space number
' and one of it's dates between the two new dates
strSQL = " SELECT count([Booking No]) AS C " _
& "FROM Bookings " _
& "WHERE (DateTo BETWEEN #" & [DateFrom] & "# AND #" &
[DateTo] & "# " _
& " OR DateFrom BETWEEN #" & [DateFrom] & "# AND #" &
[DateTo] & "#) " _
& " AND [Parking Space No] = " & [Parking Space No]
Set rs = CurrentDb.OpenR ecordset(strSQL , dbOpenDynaset)
rs.MoveFirst
If rs!C = 0 Then 'slot is free
DoCmd.DoMenuIte m acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
cmdNew.SetFocus
' Command26.Enabl ed = False
Calendar2.Enabl ed = False
myDisplayInfoMe ssage = "Booking Confirmed"
Else
myDisplayWarnin gMessage = "This has already been booked" & vbCrLf
_
& "Please choose another"
End If
Set rs = Nothing
Exit_Command26_ Click:
Exit Sub
Err_Command26_C lick:
MsgBox Err.Description
Resume Exit_Command26_ Click
End Sub

On Apr 3, 12:51 pm, "Immy" <iazah...@hotma il.comwrote:
On Apr 3, 5:43 pm, "Jason Lepack" <jlep...@gmail. comwrote:


Define "double booking". Show the structure of tables. Show sample
input with expected output. Here's some vba that may (probably
not...) help.
public sub JasonsSolution( )
msgbox "Give more information!"
end sub
I know it doesn't work but it's the best I could come up with such
limited information.
After you give more info you could be helped.
Cheers,
Jason Lepack
On Apr 3, 12:35 pm, iazah...@hotmai l.com wrote:
I use Access 2000 and I'm trying to figure out what VBA code to use to
prevent double bookings. Any help on this matter will be greatly
appreciated. Regards Immy- Hide quoted text -
- Show quoted text -

This is the code I'm using at the min and it dont work:
Private Sub Command26_Click ()
On Error GoTo Err_Command26_C lick

Dim strSQL As String
Dim intCount As Integer
strSQL = "[Parking Space No] = " & [Parking Space No] & "" _
& "AND [DateFrom] = #" & [DateFrom] & "#" _
& "AND [DateTo] = #" & [DateTo] & "#"
intCount = DCount("[Parking Space No]", "Parking Space", strSQL)

If intCount = 0 Then 'slot is free

DoCmd.DoMenuIte m acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
cmdNew.SetFocus
' Command26.Enabl ed = False
Calendar2.Enabl ed = False
myDisplayInfoMe ssage = "Booking Confirmed"

Else
myDisplayWarnin gMessage = "This has already been booked" & vbCrLf
_
& "Please choose another"

End If

Exit_Command26_ Click:
Exit Sub

Err_Command26_C lick:
MsgBox Err.Description
Resume Exit_Command26_ Click

End Sub- Hide quoted text -

- Show quoted text -

Apr 3 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
1742
by: Dan Evans | last post by:
Hi, Can anyone help me on a little problem I am having with some SQL - in particular on a subquery. I am setting up a database in Access for a voluntary group which runs
12
9893
by: Sydex | last post by:
When I compile code I get error C2664: 'Integration::qgaus' : cannot convert parameter 1 from 'double (double)' to 'double (__cdecl *)(double)' in this part : double Integration::quad2d(double (*func)(double,double)) { nfunc = func ; return qgaus(f1,x1,x2);//error there
2
1757
by: Brian O'Gorman | last post by:
I have: a) a calendar table (tblCalendar) holding consecutive dates. b) a vacancies table (tblVacancies) holding start and end dates of vacancies c) a bookings table (tblBookings holding start and end dates of each booking for a given vacancy. Can anyone tell me how I can generate, with queries, start and end dates for the vacant periods of a given vacancy? e.g.
8
1955
by: Mike Jolley | last post by:
Hello First off, I'm a student so I'm pretty new to C++, and therefore I have probably made a stupid mistake somewhere. Anyway Ive been trying to fix this 5 hours straight now, so i need a little assistance. What I'm trying to do I am using inheritance to make some bookings for a marina, which are: Booking
6
3203
by: Jim Devenish | last post by:
I have an unbound form that displays all the days of the year as a calendar. It has 12 rows of text boxes with either 29,30 or 31 in each row. Text box names are of the form: display_01_01, display_01_02 ... display_12_31. This is used to display bookings of holiday properties and works well. I am now wishing to be able to highlight a range of dates by double clicking in one text box and then in another, highlighting all the dates...
9
1587
Jacotheron
by: Jacotheron | last post by:
For one of my clients I must make an internet bookings page. The script must view all bookings that is happening in the future and it must accept new bookings entries that may be added by the viewer if they are interested. How do I make a booking addable. The client too must receive a notification of the booking by email. Does someone have any idea how I am supposed to do this?
0
1279
by: Yew12 | last post by:
I'm trying to use PL/SQL to create a trigger that will stop bookings. Based on a duration field and a start time. I have had a go at trying to do this but I'm sure that im well off from where I need to be. Create or Replace Trigger multiple_appointments Before insert on appointment Begin IF (NEW.toNumber(ADATE) between toNumber(ADATE + "Duration(Min)" from Appointmenmt)
3
4660
by: Wayne | last post by:
I'm building a bookings database for trucks that among other things captures the TruckName, LoadDate, LoadTime, UnloadDate and UnloadTime. Is there a simple way to prevent double bookings for any particular truck so that when a new entry is being added, if the LoadDate and LoadTime doubles up with an existing entry I can flag it to the user?
4
2680
by: phill86 | last post by:
Hi, I am trying to represent on a form time slots I have re-created the look of an outlook calendar on the form I have a table with the calendar bookings start and end time and there could be any number of bookings in a day. The following code represents the column for the first day of the week (monday) and formats the text boxes accordingly if the room is booked. This all works fine but I have to have this code again to represent the...
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9481
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10155
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10095
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9953
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7502
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3655
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.