B
Brian Beck
I have a table, tDistrictSub, in Access 2003 that contains various pieces of
information. The relevant fields in this table for this problem are:
DistrictIncidentNum - the pk (always a 9-digit number, then a dash, followed
by another 9 digit number)
DistrictIncidentID - the 9-digit number in front of the dash from above
I also have a table, tAttachments, that has the following fields:
AttachmentID - the pk (autogenerated)
DistrictIncidentNum - linked to tDistrictSub
Attachment - contains the filename of an attachment.
I've created a form, fDistrictSub, that lists information for any given
DistrictIncidentNum. What I want to do, is add a command button to this
form that will allow me to print out all the attachments for the record
currently showing in fDistrictSub.
I created a query, qAttachments, to return all the values for
tAttachments.Attachment where the value of fDistSub.DistrictIncidentNum is
equal to tAttachments.DistrictIncidentNum. I've also placed a subform,
fAttachments, in my fDistrictSub to show me attachments there are for the
currently selected record.
My problem comes in trying to write some VBA code for the command button's
onClick event. I know how to get the files to print out, but I don't know
how I can get the various attachment filenames moved into variables so that
I can then grab the extension from the end of the name and determine what
program needs to be used to open and print out the attachment. Plus, since
there can be any number of attachments for a given DistrictIncidentNum, I
need some way of determining how many attachments I need to print.
Any ideas?
-Brian Beck
information. The relevant fields in this table for this problem are:
DistrictIncidentNum - the pk (always a 9-digit number, then a dash, followed
by another 9 digit number)
DistrictIncidentID - the 9-digit number in front of the dash from above
I also have a table, tAttachments, that has the following fields:
AttachmentID - the pk (autogenerated)
DistrictIncidentNum - linked to tDistrictSub
Attachment - contains the filename of an attachment.
I've created a form, fDistrictSub, that lists information for any given
DistrictIncidentNum. What I want to do, is add a command button to this
form that will allow me to print out all the attachments for the record
currently showing in fDistrictSub.
I created a query, qAttachments, to return all the values for
tAttachments.Attachment where the value of fDistSub.DistrictIncidentNum is
equal to tAttachments.DistrictIncidentNum. I've also placed a subform,
fAttachments, in my fDistrictSub to show me attachments there are for the
currently selected record.
My problem comes in trying to write some VBA code for the command button's
onClick event. I know how to get the files to print out, but I don't know
how I can get the various attachment filenames moved into variables so that
I can then grab the extension from the end of the name and determine what
program needs to be used to open and print out the attachment. Plus, since
there can be any number of attachments for a given DistrictIncidentNum, I
need some way of determining how many attachments I need to print.
Any ideas?
-Brian Beck