Unanswered: How To 'Extract' Some Value From Tables
I have documents in my database. Each document has an ID to seperate them. They have all the usual other document fields, but also a 'Report Name' field. In this field i have the name of the access report used to 'view' this document. I have this so when viewing old documents you can see it the way it was sent if the document template was updated (its to do with our Quality Assurance system).
I am changing the way my Database works a little. I have document logs page which i had a standard 'details' form, but now i am changing it to a form with a list box. I can extract the document ID from this list box easy. But now that i have this i need to find out the report name, so that when the buttons for previewing and printing the document are pushed they work. So how do i extract that value from in my code? My current code is (for printing)
Dim stLinkCriteria As String
stLinkCriteria = "[Doc ID]=" & Me![Doc ID]
DoCmd.OpenReport [Form_Number], acPreview, , stLinkCriteria
DoCmd.Close acReport, [Form_Number]
I need to use the Doc ID to find the Form_Number cause it isn't in the list box. They are both in the same table called T-Documents. This is for access 2000 and is a front and back end database btw.
Gosh - this seems fairly trivial given the reasonably complex set up you already have
Is there any reason you can't include the report name in the query that populates the list box and just set the coumn width to 0 (therefore hiding it)? The name would then be there already and you wouldn't need to do anything fancy to retrieve it. If this is a problem then there are other methods available anyway.
I handle this function (preserving how the document looked when it was issued) by printing the document to snapshot and actually saving the snapshot file.
In anycase, as suggested, include that field in your combo box query. Lookup the Column property (among others) of combo boxes for direction on getting the value sitting in positions other than the bound column in a combo box.
yeah i know i can just hide the column but i am interested in learning other methods of doing so. if i can get this working i can use it in other areas of my database.
for example i plan on integrating a user system into my database. i have found various ways of retrieving the username of windows (ie. what they are logged in as), but i want to use that username to then check in a table and then read different columns to see what permisions they have, which would be ticked yes or no. So if they could make reports, print them or not etc. , if they are an admin, manager, project manager or just a user etc. then each one would be able to get into different areas.