![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hey There, Have a problem, hopefully someone out here can lend me a hand. Working on an appointment databases, haven't used VBA in ages and I am find a lot of rust everywhere. What I'm trying to do, search the databases using Dcount for any records that match the Date and time of the appointment prior to it being added to the database, however have not been successful. Moreover I was looking for an easy way out, that's the reason behind choosing DCount, however if anyone else can offer a better suggestion I'll be listening. Below is my code, don't laugh but offer suggestions Once I can get beyond the checkingto see if an appointment already exists for that date and time I can move forward, but I've fallen and cannot get up and need some help! Private Sub cmdGenerate_Click() Dim strsTime As Date Dim strsDate As Date Dim intX As Integer strsTime = Me.txtsTime strsDate = Me.txtsDate intX = DCount("[AppointmentID]", "tblAppointments", "[sTime] = strsTime AND [sDate] = #strsDate#") If intX > 0 Then MsgBox "Error! An appointment already exists with that time. Choose another date or time.", vbOKOnly, "McGill University Health Centre: Appointment Database" Else End If End Sub |
#3
| |||
| |||
|
#4
| |||
| |||
|
#5
| |||
| |||
|
|
Hey There, Have a problem, hopefully someone out here can lend me a hand. Working on an appointment databases, haven't used VBA in ages and I am find a lot of rust everywhere. What I'm trying to do, search the databases using Dcount for any records that match the Date and time of the appointment prior to it being added to the database, however have not been successful. Moreover I was looking for an easy way out, that's the reason behind choosing DCount, however if anyone else can offer a better suggestion I'll be listening. Below is my code, don't laugh but offer suggestions Once I can get beyond the checkingto see if an appointment already exists for that date and time I can move forward, but I've fallen and cannot get up and need some help! Private Sub cmdGenerate_Click() Dim strsTime As Date Dim strsDate As Date Dim intX As Integer strsTime = Me.txtsTime strsDate = Me.txtsDate intX = DCount("[AppointmentID]", "tblAppointments", "[sTime] = strsTime AND [sDate] = #strsDate#") If intX > 0 Then MsgBox "Error! An appointment already exists with that time. Choose another date or time.", vbOKOnly, "McGill University Health Centre: Appointment Database" Else End If End Sub |
![]() |
| Thread Tools | |
| Display Modes | |
| |