You are not setting any values in the variables VehicleType and VehicleVin. Where do the values come from?
Try something like this:
NOTE: You will need to update the code below for the two lines ending with the comment <<<< get value from somewhere
Private Sub CmdVehicleProfileEMail_Click() On Error GoTo CmdVehicleProfileEmail_Click_Err Dim VehicleNumber As Integer Dim VehicleType As String Dim VehicleVin As String VehicleNumber = [TFleetRef] ' set the values here VehicleType = "" ' <<<< get value from somewhere VehicleVin = "" ' ' <<<< get value from somewhere DoCmd.OpenForm "FQTVehicleProfileEMail", acNormal DoCmd.ApplyFilter "", "TFleetRef=" & VehicleNumber DoCmd.SendObject acForm, "FQTVehicleProfileEMail", "PDFFormat(*.pdf)", "", "", "", "Profile vehicle", "Vehicle Type: " & VehicleType & " - VIN " & VehicleVin DoCmd.Close CmdVehicleProfileEMail_Click_Exit: Exit Sub CmdVehicleProfileEmail_Click_Err: MsgBox "Your e-mail has not been sent" DoCmd.Close acForm, "FQTVehicleProfileEMail" DoCmd.Close acForm, "FQTVehicleProfile" Resume CmdVehicleProfileEMail_Click_Exit End Sub




Reply With Quote