Hi Guys, i am having a brain freeze here, i have a record to add a shipment date to which the Day is the same every week so the dates are added as Friday (Forms!frmMainMenu!frmIndex1!cboShipmentDateIndex1 ) is selected to Fridays date, when i choose confirm, it should add the shipment date from cboShipmentDateindex1, which works fine, i am trying to check to see if another user has already confirmed, if so, then do we want to add next friday's date or cancel, it's a one of these where it should be simple enough just side tracked and brain freeze!!,
IT WON'T ADD THE DATE TO THE CURRENT WEEK RECORD (POSTCODE)
Note all Dims as set mPC string dates are all set as dates
Code:
Dim LastDate, NewDate As DateIf Me.Confirm = True Then ' this is a tickbox
If Forms!frmMainMenu!frmIndex1!cboShipmentDateIndex1 <> "" Then
If Me.Source <> "Acc" Then
mPC = Me.PostCode
mShipDate = Forms!frmMainMenu!frmIndex1!cboShipmentDateIndex1
LastDate = DMax("ShipmentDate", "tblEdit", "[PostCode] = '" & mPC & "'")
NewDate = DateAdd("d", 7, LastDate)
If LastDate = mShipDate Then
If MsgBox("You Already Have This Record For:" & " " & LastDate & Chr(10) & Chr(10) & _
"Do You Want To Add For The Following Week" & " " & NewDate & " " & "?", vbQuestion + vbYesNo, "ALREADY EXISTS") = vbNo Then
Me.ShipmentDate = mShipDate
Else
Me.ShipmentDate = NewDate
End If
Dim mday As Integer
mday = Weekday(mShipDate, vbUseSystemDayOfWeek)
WKDay = WeekdayName(mday)
Me.Status = WKDay
Me.SL = "SL-" & " " & Me.Source & " " & Format(Me.ShipmentDate, "ddmmyy")
DoCmd.OutputTo acOutputReport, "rptPO", acFormatPDF, "T:\DMT\PDF\DMT SL's\" & Me.SL & ".pdf"
End If
End If
End If
End If