Setting up an Emergency Messaging Database for FUTURE Emergency Events. Namely Hurricanes. With a form I prompt end-user to fill out Event Type, Name, Year, Month, then concatenate fields [FullName]. Okay button runs a Visual Basic module that copies a MasterTable, and calls it the concatenated field, copies two Master Forms (fill out/ print) and names them the concatenated field, and copies a report, and names it the concatenated field. IE: Hurricane Tony 2006 08
How do I set the Record Source for these new objects???
The concatenated field is defined as a string: NewEvent
Dim strNewEvent As String
strNewEvent = Forms!PromptEventName!FullName
DoCmd.CopyObject "", strNewEvent, acTable, "MasterTable"
DoCmd.CopyObject "", strNewEvent, acForm, "MasterForm"
Forms!strNewEvent.RecordSource = strNewEvent
(doesn't work .. says it can't find form strNewEvent)
So thinking I may need to use an existing form name I thought I would change the record source of the MasterForm before copying it, then change it back later:
DoCmd.CopyObject "", strNewEvent, acTable, "MasterTable"
Forms!MasterForm.RecordSource = strNewEvent
DoCmd.CopyObject "", strNewEvent, acForm, "MasterForm"
(error message says it can't find MasterForm, or form is not open, or module not compiling. Love the specificity of these error messages. Does form have to be open to change recordSource Property?? So I first try to open Masterform (DoCmd.OPen), error says it can't find it. I have definitly spelled the form correctly.
Any advice at all? Need to get this done by 10:00am tomorrow .. or maybe by 1:30 if I can push them off.
MArgoo
How do I set the Record Source for these new objects???
The concatenated field is defined as a string: NewEvent
Dim strNewEvent As String
strNewEvent = Forms!PromptEventName!FullName
DoCmd.CopyObject "", strNewEvent, acTable, "MasterTable"
DoCmd.CopyObject "", strNewEvent, acForm, "MasterForm"
Forms!strNewEvent.RecordSource = strNewEvent
(doesn't work .. says it can't find form strNewEvent)
So thinking I may need to use an existing form name I thought I would change the record source of the MasterForm before copying it, then change it back later:
DoCmd.CopyObject "", strNewEvent, acTable, "MasterTable"
Forms!MasterForm.RecordSource = strNewEvent
DoCmd.CopyObject "", strNewEvent, acForm, "MasterForm"
(error message says it can't find MasterForm, or form is not open, or module not compiling. Love the specificity of these error messages. Does form have to be open to change recordSource Property?? So I first try to open Masterform (DoCmd.OPen), error says it can't find it. I have definitly spelled the form correctly.
Any advice at all? Need to get this done by 10:00am tomorrow .. or maybe by 1:30 if I can push them off.
MArgoo