1

In my main menu form I have provided a button to check the tasks due as a reminder. In this assigned to field is coming as number , because in in my table it is of number type & it is linked to contact table to retrieve the data. So in my message box I need this number to be converted as the data stored my contact table. & also I can't increase the size of the message box so it is looking messy. please go through the attached images and code & help me.[table][messagebox[]][datatype restriction`

Option Compare Database

Private Sub cmdreminder_Click()
Dim RS As DAO.Recordset
Dim strMsg As String
Set RS = CurrentDb.OpenRecordset("Tasks", dbOpenSnapshot, dbReadOnly)

With RS
    If Not (.BOF And .EOF) Then
        .MoveFirst
        While Not .EOF
            If ![Due Date] >= Date - 7 Then
              strMsg = strMsg & ![Title] & vbTab & vbTab & vbTab & ![Assigned to] & vbTab & vbTab & vbTab & ![Due Date] & vbCrLf
            End If
            .MoveNext
        Wend
    End If
    .Close
End With
Set RS = Nothing
If strMsg <> "" Then
   strMsg = "The following Tasks are due!!!:" & vbTab & vbTab & vbCrLf & vbCrLf &"-----------" & vbCrLf &"Equipment Name" & vbTab & vTab & "Agency Name" & vTab & vbTab & "Due Date" & vbCrLf &"----" & vbCrLf & strMsg Else strMsg = "No Tasks is pending" End If MsgBox strMsg, vbInformation + vbOKOnly End Sub ``]

enter image description here

braX
  • 11,506
  • 5
  • 20
  • 33
RAVI KUMAR
  • 386
  • 1
  • 12
  • Create you own form and set its `Pop Up` and `Modal` properties to true. Then you can format the controls the way you want. – Kostas K. Mar 13 '20 at 08:12
  • Thank you for your reply .The data is stored in the table and it is linked to the id of the other table .so the message box is showing ID instead of text assigned .how to correct this. – RAVI KUMAR Mar 13 '20 at 08:42

1 Answers1

0

To display the task description, you need to change the datasource of the recordset from Tasks to a SQL query where you join the Tasks table with the Contact table using the task id.

Obviously I don't know the names of your table fields, but it should be something like this:

SELECT Tasks.*, Contacts.TaskDescription
FROM Tasks INNER JOIN Contacts ON Tasks.Id = Contacts.TaskId

As for styling the MessageBox, your options are limited. I would suggest to create your own Form that acts like a MessageBox.

There are plenty of examples on how to do this.

Kostas K.
  • 8,293
  • 2
  • 22
  • 28