Bilbo_Baggins_Esq
Registered User.
- Local time
- Today, 01:09
- Joined
- Jul 5, 2007
- Messages
- 586
Access 2013 x86 running in Windows 10.
I'm working on an unbound form named, "Front"
The Front form contains a Navigation Control with 4 Navigation buttons.
Welcome (click activates the unbound "Welcome" Navigation Subform)
Import (click activates the unbound "ImportData" Navigation Subform)
Export (click activates the unbound "ExportData" Navigation Subform)
Exit
On the "Welcome" and "ImportData" navigation subforms, there are various controls (buttons, text boxes, checkboxes, etc) which I need to pre-populate with values I pull from the database.
Opening each of the navigation subforms directly (without going through the Front form) I wrote code (in a proper module) with which I'm able to successfully accomplish my goals.
However, I cannot for the life of me figure out how to refer to the navigation subform (or controls) when I drop my previously working sub into an event driven action.
This, even when I try to just call the sub in the proper module.
I'm about to shoot this thing.
I've searched a lot of resources and tried various formats of syntax and nothing seems to work.
Sometimes I get the error Access can't find the form, and sometimes I get the error that Access can't find the field (WTH).
Here's the code that actually works when I have the ImportData subform open directly
(the objects you see me setting are declared as public elsewhere)
PLEASE HELP BEFORE I RUN OUT OF HAIR TO PULL OUT!!!
I'm working on an unbound form named, "Front"
The Front form contains a Navigation Control with 4 Navigation buttons.
Welcome (click activates the unbound "Welcome" Navigation Subform)
Import (click activates the unbound "ImportData" Navigation Subform)
Export (click activates the unbound "ExportData" Navigation Subform)
Exit
On the "Welcome" and "ImportData" navigation subforms, there are various controls (buttons, text boxes, checkboxes, etc) which I need to pre-populate with values I pull from the database.
Opening each of the navigation subforms directly (without going through the Front form) I wrote code (in a proper module) with which I'm able to successfully accomplish my goals.
However, I cannot for the life of me figure out how to refer to the navigation subform (or controls) when I drop my previously working sub into an event driven action.
This, even when I try to just call the sub in the proper module.
I'm about to shoot this thing.
I've searched a lot of resources and tried various formats of syntax and nothing seems to work.
Sometimes I get the error Access can't find the form, and sometimes I get the error that Access can't find the field (WTH).
Here's the code that actually works when I have the ImportData subform open directly
(the objects you see me setting are declared as public elsewhere)
Code:
Sub CheckPath()
Set obj_WS = DBEngine.Workspaces(0)
Set obj_DB = obj_WS.Databases(0)
If IsNull(GetParameter("Raw_Data_Root_Path", 2)) Then
Forms("ImportData").Controls("Button_Import").Enabled = False
Forms("ImportData").Controls("Button_Import").Caption = "Set Raw Data Root Folder First"
Forms("ImportData").Controls("Text_RootPath").Value = ""
Else
Forms("ImportData").Controls("Button_Import").Enabled = True
Forms("ImportData").Controls("Button_Import").Caption = "Import Data"
Forms("ImportData").Controls("Text_RootPath").Value = GetParameter("Raw_Data_Root_Path", 2)
End If
Set rs_ReportsToRun = obj_DB.OpenRecordset("ReportsToRun", dbOpenDynaset)
Do While Not rs_ReportsToRun.EOF
Select Case rs_ReportsToRun.Fields(2)
Case Is = "MISBC"
Forms("ImportData").Controls("Check_MISBC").Value = rs_ReportsToRun.Fields(3)
Case Is = "SBHD"
Forms("ImportData").Controls("Check_SBHD").Value = rs_ReportsToRun.Fields(3)
Case Is = "SBOT"
Forms("ImportData").Controls("Check_SBOT").Value = rs_ReportsToRun.Fields(3)
End Select
rs_ReportsToRun.MoveNext
Loop
rs_ReportsToRun.Close
Set rs_ReportsToRun = Nothing
obj_DB.Close
Set obj_DB = obj_WS.Databases(0)
obj_WS.Close
Set obj_WS = DBEngine.Workspaces(0)
End Sub
PLEASE HELP BEFORE I RUN OUT OF HAIR TO PULL OUT!!!