I have read Gord Thompson's reply to the same question and attempted to apply the code that was given in the previous forum but I cannot get the code to work.
I have created a module called CaptionCallModule and here is what it looks like:
Option Compare Database
Private Sub frmMainMenu_Open(Cancel As Integer)
DVD_CD_Inventory_List.Caption = DLookup("Caption", "MainMenu", "ID=1")
frmBorrower.Caption = DLookup("Caption", "MainMenu", "ID=2")
frmDVD_CD_Check_Out_In.Caption = DLookup("Caption", "MainMenu", "ID=3")
frmMedia.Caption = DLookup("Caption", "MainMenu", "ID=4")
frmQuickSearchMedia.Caption = DLookup("Caption", "MainMenu", "ID=5")
rptBorrower.Caption = DLookup("Caption", "MainMenu", "ID=6")
rptMediaList.Caption = DLookup("Caption", "MainMenu", "ID=7")
rptPastDue.Caption = DLookup("Caption", "MainMenu", "ID=8")
End Sub
Private Sub DVD_CD_Inventory_List_Click()
DVD_CD_Inventory_List.Caption = DLookup("Caption", "MainMenu", "ID=1")
Dim varBorrower As Variant
varBorrower = DLookup("[FRName]", "MainMenu", "[ID]=1")
DoCmd.OpenForm varBorrower, acViewForm
DVD_CD_Inventory_List_Click_Exit:
Exit Sub
End Sub
Private Sub frmBorrower_Click()
frmBorrower.Caption = DLookup("Caption", "MainMenu", "ID=2")
Dim varPerson As Variant
varPerson = DLookup("[FRName]", "MainMenu", "[ID]=2")
DoCmd.OpenForm varPerson, acViewForm
frmBorrower_Click_Exit:
Exit Sub
End Sub
Private Sub frmDVD_CD_Check_Out_In_Click()
frmDVD_CD_Check_Out_In.Caption = DLookup("Caption", "MainMenu", "ID=3")
Dim varDVDCD As Variant
varMedia = DLookup("[FRName]", "MainMenu", "[ID]=3")
DoCmd.OpenForm varDVDCD, acViewForm
frmDVD_CD_Check_Out_In_Click_Exit:
Exit Sub
End Sub
Private Sub frmMedia_Click()
frmMedia.Caption = DLookup("Caption", "MainMenu", "ID=4")
Dim varMedia As Variant
varMedia = DLookup("[FRName]", "MainMenu", "[ID]=4")
DoCmd.OpenForm varMedia, acViewForm
frmMedia_Exit:
Exit Sub
End Sub
Private Sub frmQuickSearchMedia_Click()
frmQuickSearchMedia.Caption = DLookup("Caption", "MainMenu", "ID=5")
Dim varSearch As Variant
varSearch = DLookup("[FRName]", "MainMenu", "[ID]=5")
DoCmd.OpenForm varSearch, acViewForm
frmQuickSearchMedia_Exit:
Exit Sub
End Sub
Private Sub rptBorrower_Click()
rptBorrower.Caption = DLookup("Caption", "MainMenu", "ID=6")
Dim varSubject As Variant
varSubject = DLookup("[FRName]", "MainMenu", "[ID]=6")
DoCmd.OpenReport varSubject, acViewReport
rptBorrower_Exit:
Exit Sub
End Sub
Private Sub rptMediaList_Click()
rptMediaList.Caption = DLookup("Caption", "MainMenu", "ID=7")
Dim varList As Variant
varList = DLookup("[FRName]", "MainMenu", "[ID]=7")
DoCmd.OpenReport varList, acViewReport
rptMediaList_Exit:
Exit Sub
End Sub
Private Sub rptPastDue_Click()
rptPastDue.Caption = DLookup("Caption", "MainMenu", "ID=8")
Dim varDue As Variant
varDue = DLookup("[FRName]", "MainMenu", "[ID]=8")
DoCmd.OpenReport varDue, acViewReport
rptPastDue_Exit:
Exit Sub
End Sub
This is throwing a runtime error 424 and the debugger highlights the rptMediaListCaption line.
I am using Access 2013. I really need to get this to work. It is for college but you can see I am really trying.
If anyone can help I would greatly appreciate it.
Thanks,
BugsyFrank