Greetings:
I searched for an answer, but couldn't find an existing post that met my needs. I'm a long-time Access user, and have created many databases for personal use. However, I'm not a programmer, and have little knowledge of creating VBA. I would greatly appreciate help!
Our agency conducts forensic interviews of children who've been severely abused or sexually assaulted for purposes of criminal prosecution of offenders. In addition, the agency provides counseling and numerous other services to victims and their families. Staff must enter intake information for each child in a case file. They must also keep track of activities done for victims and families, and the amount of time spent on each of these activities.
I have a primary case file table, and a secondary table for tracking these other events--sort of a log. On the day of the interview of the child, the staff spends about 3 hours on various activities before, during, and after the interview. Upon entering a new case file in the primary table, I would like to have a record automatically created in the log table with the case ID from the primary table and an entry of 3 hours activity for that initial work. I'm sure this can be accomplished via some code, but I don't know where to begin to create it...
Here's structure info:
tblCaseFile: Main table - all victim demographic data, and other case-related data is entered and tracked in/from this table.
formEditCaseFiles: used by staff to work with case files after initial data entry; the fields from tblCaseFile are arranged on this form in a format that corresponds to staff needs during on-going case tracking. It is tabbed. One of the tabs is called "Family Advocacy Log" and displays subfrmFamilyAdvLog, which displays fields for tblFamilyAdvocacyActivity.
Can anyone suggest code (sorry, but you'll have to be very patient and quite literal since I've not written code before...) to do the following:
1. After initial data entry of a new record in tblCaseFile (with a new CaseID) using formInitialIntake, clear out all temporary variables that might be in use from other activities in the database, and then gather information from the new record for CaseID, InterviewDate, InterviewTime, and IntakeCompletedBy fields into temporary variables.
2. Automatically create a new record in tblFamilyAdvocacyActivity (FaaID is an autonumber...)
3. Dump the temporary variables into fields within this new record as follows:
5. Enter "3" into FamilyAdvocacyActivity.ActivityLength
6. Enter text of "Initial case management activities" into FamilyAdvocacyActivity.Description
Thanks in advance for any help/suggestions/code you may offer!
Lou
I searched for an answer, but couldn't find an existing post that met my needs. I'm a long-time Access user, and have created many databases for personal use. However, I'm not a programmer, and have little knowledge of creating VBA. I would greatly appreciate help!
Our agency conducts forensic interviews of children who've been severely abused or sexually assaulted for purposes of criminal prosecution of offenders. In addition, the agency provides counseling and numerous other services to victims and their families. Staff must enter intake information for each child in a case file. They must also keep track of activities done for victims and families, and the amount of time spent on each of these activities.
I have a primary case file table, and a secondary table for tracking these other events--sort of a log. On the day of the interview of the child, the staff spends about 3 hours on various activities before, during, and after the interview. Upon entering a new case file in the primary table, I would like to have a record automatically created in the log table with the case ID from the primary table and an entry of 3 hours activity for that initial work. I'm sure this can be accomplished via some code, but I don't know where to begin to create it...
Here's structure info:
tblCaseFile: Main table - all victim demographic data, and other case-related data is entered and tracked in/from this table.
Primary key: CaseID; this is a text field. (It is not an autonumber because this ID number is assigned by agency staff using a specified format.)
Other fields in this table relevant to my question:
tblFamilyAdvocacyActivity: log of activities completed on behalf of victimsOther fields in this table relevant to my question:
- InterviewDate (short date format)
- InterviewTime (medium time)
- IntakeCompletedBy (number format; this field links to a lookup table with all staff names and corresponding staff IDs -- when a name is selected from the field drop-down, the staffID is stored CaseFile.IntakeCompletedBy)
Primary key: FaaID - autonumber
CaseID - text format; linked to CaseFile.CaseID in a 1-many relationship with referential integrity enforced and cascade delete enabled
Other fields in this table relevant to my question:
formInitialIntake: used by staff only to enter new cases into tblCaseFile; fields on this form are arranged to match the order of fields on printed intake formsCaseID - text format; linked to CaseFile.CaseID in a 1-many relationship with referential integrity enforced and cascade delete enabled
Other fields in this table relevant to my question:
- ActivityDate (short date format)
- ActivityTime (medium time format)
- StaffID (number format; also links to same lookup table with staff names/staff IDs -- when name is selected from field drop-down, staffID is stored in FamilyAdvocacyActivity.StaffID
- ActivityType (text format; links to a lookup table with a list of the types of activities and corresponding ActivityIDs -- when an activity type is selected from the field drop-down, the ActivityID is stored in FamilyAdvocacyActivity.ActivityType
- ActivityLength (number format; hours spent by staff on an advocacy activity)
formEditCaseFiles: used by staff to work with case files after initial data entry; the fields from tblCaseFile are arranged on this form in a format that corresponds to staff needs during on-going case tracking. It is tabbed. One of the tabs is called "Family Advocacy Log" and displays subfrmFamilyAdvLog, which displays fields for tblFamilyAdvocacyActivity.
Can anyone suggest code (sorry, but you'll have to be very patient and quite literal since I've not written code before...) to do the following:
1. After initial data entry of a new record in tblCaseFile (with a new CaseID) using formInitialIntake, clear out all temporary variables that might be in use from other activities in the database, and then gather information from the new record for CaseID, InterviewDate, InterviewTime, and IntakeCompletedBy fields into temporary variables.
2. Automatically create a new record in tblFamilyAdvocacyActivity (FaaID is an autonumber...)
3. Dump the temporary variables into fields within this new record as follows:
a. CaseFile.CaseID to FamilyAdvocacyActivity.CaseID
b. CaseFile.InterviewDate to FamilyAdvocacyActivity.ActivityDate
c. CaseFile.InterviewTime to FamilyAdvocacyActivity.ActivityTime
d. CaseFile.IntakeCompletedBy to FamilyAdvocacyActivity.StaffID
4. Enter activity type of "InitialCaseMgt" into FamilyAdvocacyActivity.ActivityTypeb. CaseFile.InterviewDate to FamilyAdvocacyActivity.ActivityDate
c. CaseFile.InterviewTime to FamilyAdvocacyActivity.ActivityTime
d. CaseFile.IntakeCompletedBy to FamilyAdvocacyActivity.StaffID
5. Enter "3" into FamilyAdvocacyActivity.ActivityLength
6. Enter text of "Initial case management activities" into FamilyAdvocacyActivity.Description
Thanks in advance for any help/suggestions/code you may offer!
Lou
