Good Morning.
The last couple of days I have been getting an Compile error, Ambiguous name detected: gDummy error. I never changed anything in the code so I am not sure what prompted this problem.
This line of code is high lighted in yellow Public Sub OpenAppointmentForm(vDate As Date) and the word gDummy in this line is high lighted in blue. I use Access 2016.
I also note that the below code is in Code tags but to me it looks like it is not. I apologize if it looks the same to you.
Thanks Cheeco
Code:Option Compare Database Option Explicit Private Sub cmdDay_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) OpenDayCalendar X 'switch to Daily mode End Sub Private Sub cmdWeekNo_Click() 'Switch calendar mode to Weekly for selected date 'Entry (Me.Day1Date) holds date to be displayed 'Exit Calendar changed to Weekly mode for selected date Me.Parent!txtCurrentDate = Me.Day1Date 'set Current Date to Monday of current week Me.Parent!txtMode = 2 'change mode in parent form CheckMode Me.Parent 'Run CheckMode subroutine in parent form ### End Sub Private Sub Day1Data_Click() Parent!txtCurrentDate = Me.Day1Date 'set current date when user clicks on a date field Me.Day1Data.Requery 'set field to edit mode to enable arrow keys End Sub Private Sub Day1Data_DblClick(Cancel As Integer) OpenAppointmentForm Me.Day1Date 'open Appointment form when user double clicks cell End Sub Private Sub Day1Data_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then 'if ENTER key pressed then If conEnterKey = 0 Then OpenAppointmentForm Me.Day1Date 'open Appointment form for current date KeyCode = 0 'disable key code to prevent focus moving to next cell End If End Sub Private Sub Day2Data_Click() Parent!txtCurrentDate = Me.Day2Date Me.Day2Data.Requery 'set field to edit mode to enable arrow keys End Sub Private Sub Day2Data_DblClick(Cancel As Integer) OpenAppointmentForm Me.Day2Date End Sub Private Sub Day2Data_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then 'if ENTER key pressed then If conEnterKey = 0 Then OpenAppointmentForm Me.Day2Date 'open Appointment form for current date KeyCode = 0 'disable key code to prevent focus moving to next cell End If End Sub Private Sub Day3Data_Click() Parent!txtCurrentDate = Me.Day3Date Me.Day3Data.Requery 'set field to edit mode to enable arrow keys End Sub Private Sub Day3Data_DblClick(Cancel As Integer) OpenAppointmentForm Me.Day3Date End Sub Private Sub Day3Data_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then 'if ENTER key pressed then If conEnterKey = 0 Then OpenAppointmentForm Me.Day3Date 'open Appointment form for current date KeyCode = 0 'disable key code to prevent focus moving to next cell End If End Sub Private Sub Day4Data_Click() Parent!txtCurrentDate = Me.Day4Date Me.Day4Data.Requery 'set field to edit mode to enable arrow keys End Sub Private Sub Day4Data_DblClick(Cancel As Integer) OpenAppointmentForm Me.Day4Date End Sub Private Sub Day4Data_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then 'if ENTER key pressed then If conEnterKey = 0 Then OpenAppointmentForm Me.Day4Date 'open Appointment form for current date KeyCode = 0 'disable key code to prevent focus moving to next cell End If End Sub Private Sub Day5Data_Click() Parent!txtCurrentDate = Me.Day5Date Me.Day5Data.Requery 'set field to edit mode to enable arrow keys End Sub Private Sub Day5Data_DblClick(Cancel As Integer) OpenAppointmentForm Me.Day5Date End Sub Private Sub Day5Data_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then 'if ENTER key pressed then If conEnterKey = 0 Then OpenAppointmentForm Me.Day5Date 'open Appointment form for current date KeyCode = 0 'disable key code to prevent focus moving to next cell End If End Sub Private Sub Day6Data_Click() Parent!txtCurrentDate = Me.Day6Date Me.Day6Data.Requery 'set field to edit mode to enable arrow keys End Sub Private Sub Day6Data_DblClick(Cancel As Integer) OpenAppointmentForm Me.Day6Date End Sub Private Sub Day6Data_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then 'if ENTER key pressed then If conEnterKey = 0 Then OpenAppointmentForm Me.Day6Date 'open Appointment form for current date KeyCode = 0 'disable key code to prevent focus moving to next cell End If End Sub Private Sub Day7Data_Click() Parent!txtCurrentDate = Me.Day7Date Me.Day7Data.Requery 'set field to edit mode to enable arrow keys End Sub Private Sub Day7Data_DblClick(Cancel As Integer) OpenAppointmentForm Me.Day7Date End Sub Private Sub Day7Data_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then 'if ENTER key pressed then If conEnterKey = 0 Then OpenAppointmentForm Me.Day7Date 'open Appointment form for current date KeyCode = 0 'disable key code to prevent focus moving to next cell End If End Sub Public Sub OpenAppointmentForm(vDate As Date) 'Opens Appointment Schedule form when user double clicks an date field 'Entry (vDate) holds date of selected cell 'Exit Appointment form displayed and new appointments displayed when form closed DoCmd.OpenForm "frmCalendarAppt", , , , , acDialog, vDate + conFirstTime 'open form to add or amend appointment (use 08:00 as default time here) If gDummy = 1 Then 'if any appt changed or added or deleted then ShowMonthAppts Parent.txtDate 'update amended calendar Parent.frmCalendarMonth.Requery 'and refresh subform End If End Sub Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) On Error Resume Next 'ignore error if user tries to move to prev or next record that does not exist Select Case KeyCode 'check Keycode Case vbKeyDown 'if Down arrow then DoCmd.GoToRecord , , acNext 'go to next record KeyCode = 0 Case vbKeyUp 'if Up arrow then DoCmd.GoToRecord , , acPrevious 'go to prev record KeyCode = 0 End Select Exit Sub ErrorCode: MsgBox Err.Description End Sub Private Sub Form_Open(Cancel As Integer) 'Change back color of Conditional Format Condition (1) to light grey color Dim vCount As Long Dim vBool As Boolean 'Update CF expression for field Day1Data with time slots to show in white and grey If conMonthHide = 1 Then vBool = False Else vBool = True For vCount = 1 To 7 'for each day field on form Me("Day" & vCount & "Data").FormatConditions(1).BackColor = conLightGrey 'and change back color of Day-n-Data to light grey color Me("Day" & vCount & "Date").FormatConditions(1).BackColor = conLightGrey 'and change back color of Day-n-Date to light grey color Me("Day" & vCount & "Data").FormatConditions(1).Enabled = vBool 'enable/disable edit option if conMonthHide option = 0/1 Next End Sub Public Sub OpenDayCalendar(vX As Single) 'Switch calendar mode to Daily for selected date 'Entry (vX) X co-ords of mouse on hidden button 'Exit Calendar changed to Daily mode for selected date Me.Parent!txtCurrentDate = Me.Day1Date + (vX \ Me.Day1Date.Width) 'set Current Date on parent form Me.Parent!txtMode = 3 'change mode in parent form CheckMode Me.Parent 'Run CheckMode subroutine in parent form ### End Sub


Reply With Quote

