Ok folks its Friday & I'm feeling a bit thick (also not very well).
I have a form Salonmanagerdet ail wich allows the user to enter the following details Stylist_Id,Styl ist_Name,Group_ Name & SM_Dates. SM_Dates are the dates a stylist is designated Salon Manager for (This happens every x weeks).
This data is stored in the table Salonmanagerdet ail. Users can view this data via the View Stylist form which is a tabbed form with 3 tabs - Stylist Details, Comments & History & Salon Manager( This uses the select query Salonman).
All this works ok.
I have a module show details which populates the sub form viewbookings-subform which is on the form viewbookings. This pulls in data about a booking. What I would now like to do is add to this module so that if SM_Dates is equal to todays date then it populates the grid with "SALON MANAGER" for any SM_Dates that match the current date.
Below is the code of my module ShowDetails
Was thinking that maybe another If statement at IF ISNULL(BookingN umber) line of code. My coding skills aren't that great so I'm not sure what would work to accomplish this. I'm hoping this is do able as I would then be looking to expand this to include Holiday dates as well (possibly). Also would like to be able to show a message box if the stylist is designated as Salon Manager & also has a booking (isn't supposed to occur)
I have a form Salonmanagerdet ail wich allows the user to enter the following details Stylist_Id,Styl ist_Name,Group_ Name & SM_Dates. SM_Dates are the dates a stylist is designated Salon Manager for (This happens every x weeks).
This data is stored in the table Salonmanagerdet ail. Users can view this data via the View Stylist form which is a tabbed form with 3 tabs - Stylist Details, Comments & History & Salon Manager( This uses the select query Salonman).
All this works ok.
I have a module show details which populates the sub form viewbookings-subform which is on the form viewbookings. This pulls in data about a booking. What I would now like to do is add to this module so that if SM_Dates is equal to todays date then it populates the grid with "SALON MANAGER" for any SM_Dates that match the current date.
Below is the code of my module ShowDetails
Code:
Function ShowDetails(BookingNumber) On Error GoTo err_tag Dim cSQL As String, DEBUGTrueorFalse As Boolean 'Change value to switch debug mode on or off DEBUGTrueorFalse = True '\\ Change value ' If IsNull(BookingNumber) Then Exit Function End If cSQL = "SELECT [Booking].[Client_Id_No] & ' ' & [Booking_Client_Name] & Chr(13) & Chr(10) & [Booking_Contact_Number] & Chr(13) & Chr(10) & [Booking_Number] & ' ' & [Booking_Appoint_Type] AS ApptDetails, Booking.Booking_Number " & _ "FROM [Booking]" & _ "WHERE ((Booking.Booking_Number)=" & BookingNumber & ")" If DEBUGTrueorFalse = True Then Debug.Print cSQL Dim con As Object Dim rst As Object Dim stsql As String, rv As String, cQuals Set con = Application.CurrentProject.Connection If DEBUGTrueorFalse = True Then Debug.Print con Set rst = CreateObject("ADODB.Recordset") rst.Open cSQL, con, 1 ' 1 = adOpenKeyset If rst.EOF Then Exit Function rst.MoveFirst ShowDetails = rst!apptdetails 'If DEBUGTrueorFalse = True Then Debug.Print rst!apptDetails exit_tag: rst.Close Exit Function err_tag: Select Case Err.Number Case 2427 ' No value, carry on ShowDetails = "" Exit Function Case Else MsgBox Err.Number & " " & Err.Description 'Resume Next End Select End Function
Comment