Are you putting this code in each forms module? I ask as thats what it appears to be in your initial post.
I changed the naming convention for simplicity for the example (ie.MyDatabaseC1.accdb, MyDatabaseC2.accdb,MyDatabaseC3.accdb,etc.)
Use a sub in a standard module and pass the form to it.
Code:
Public Sub sSetMyColors(frm As Form)
Dim fil As String
Dim x As String
fil = Application.CurrentProject.Name
x = Mid(fil, InStrRev(fil, ".accdb") - 2, 2)
Select Case x
Case "C1"
frm.FormHeader.BackColor = RGB(232, 27, 43)
frm.txt_FormName.BackColor = RGB(232, 27, 43)
frm.txt_FormName.ForeColor = RGB(255, 255, 255)
frm.txt_FormName.Caption = frm.Name & " (C1)"
Case "C2"
frm.FormHeader.BackColor = RGB(232, 27, 43)
frm.txt_FormName.BackColor = RGB(232, 27, 43)
frm.txt_FormName.ForeColor = RGB(255, 255, 255)
frm.txt_FormName.Caption = frm.Name & " (C2)"
Case "C3"
frm.FormHeader.BackColor = RGB(232, 27, 43)
frm.txt_FormName.BackColor = RGB(232, 27, 43)
frm.txt_FormName.ForeColor = RGB(255, 255, 255)
frm.txt_FormName.Caption = frm.Name & " (C3)"
End Select
End Sub
You can then call it in each form with
Code:
Private Sub Form_Load()
sSetMyColors Me
End Sub