A
Axess08
Due to the nature of the research, I have a complex database that stores
information for what should be several seperate databases for seperate
research studies' information. Because they have information that is linked
(and also for easier non-repetitive data entry), the doctors have requested
that it be just 1 database.
All that aside, this database has 1 main "patient identification" table that
links all
tables in the database by the Patient Identification field "Pt_ID_#". (I
hate spaces, but it has been requested to be able to track the fields and
tables).
I have forms for each of these tables and again due to the nature of the
database, i cannot have a form, subform (i.e. parent child) design because of
the number of forms, so I have buttons to make the data entry easier.
I want to have the "Pt ID #" field to be autofilled in every subsequent
form. Basically I want to be able to enter the "Pt ID #" manually in the Main
form and then press a button that links to another form which opens a new
record for that patient and autofills just the "Pt ID #" field based on my
entry. Unfortunately, because I do not have the form/subform set up this has
created the problem of not being able to simply autofill the "Pt ID #" field.
I know this can be resolved simply through coding, however, I can't get it to
work. Is it possible that I am missing something? I have tried the following:
On Click (Button on the Main form):
Private Sub StudiesLink_Click()
DoCmd.OpenForm "Research Studies Table Form", , , ,acFormAdd , ,Me.[Pt ID #]
On Error GoTo Err_StudiesLink_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Research Studies Table Form"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_StudiesLink_Click:
Exit Sub
Err_StudiesLink_Click:
MsgBox Err.Description
Resume Exit_StudiesLink_Click
End Sub
information for what should be several seperate databases for seperate
research studies' information. Because they have information that is linked
(and also for easier non-repetitive data entry), the doctors have requested
that it be just 1 database.
All that aside, this database has 1 main "patient identification" table that
links all
tables in the database by the Patient Identification field "Pt_ID_#". (I
hate spaces, but it has been requested to be able to track the fields and
tables).
I have forms for each of these tables and again due to the nature of the
database, i cannot have a form, subform (i.e. parent child) design because of
the number of forms, so I have buttons to make the data entry easier.
I want to have the "Pt ID #" field to be autofilled in every subsequent
form. Basically I want to be able to enter the "Pt ID #" manually in the Main
form and then press a button that links to another form which opens a new
record for that patient and autofills just the "Pt ID #" field based on my
entry. Unfortunately, because I do not have the form/subform set up this has
created the problem of not being able to simply autofill the "Pt ID #" field.
I know this can be resolved simply through coding, however, I can't get it to
work. Is it possible that I am missing something? I have tried the following:
On Click (Button on the Main form):
Private Sub StudiesLink_Click()
DoCmd.OpenForm "Research Studies Table Form", , , ,acFormAdd , ,Me.[Pt ID #]
On Error GoTo Err_StudiesLink_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Research Studies Table Form"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_StudiesLink_Click:
Exit Sub
Err_StudiesLink_Click:
MsgBox Err.Description
Resume Exit_StudiesLink_Click
End Sub