If I could punch, kick, bite, strangle, and gauge Access I would be brought up on assault charges right now. I am that frustrated with how complicated it is to do basic actions. I know VBA quite well (in Excel), and am not intimidated by it; however, I want to do this without VBA, and I have my reasons (mostly that I want to learn general Access methods before going to VBA).
I've followed the endless Google results on how to do this, and I've come close but I am either doing something wrong or my setup doesn't work for the directions I have found. I have a form that is used for data entry only, with a button/macro that saves the record, closes the form, and is supposed to open a report on the record just saved.
Here is how the database is setup: There is the main table for recording incidents (the form mentioned above saves new records to this table). There are then a few other tables that link to this main table. For example, in the main table is a field for store id that is linked to a table with the store's id (PK) and the store's name. Then I have the report I want to open and review the latest saved record with, and its data source is set to the main table.
Here is what I have tried. With the button on the data entry form, I have set a macro to OpenReport, the correct report assigned, and then in the 'where condition' I have [AutoID]=[Forms]![frmInfraction]![tbxAutoID]. The first AutoID is a field in the main table, and the tbxAutoID is the control on the form with the saved record's auto id number.
This APPEARS to work; however, the report shows the store's code (because that is what is stored in the main table) and not the store's name (which is linked from the main table). Meaning: this way only seems to allow me to create a report off the fields of the underlining table, and not allow controls on the report that are linked of the underlining fields.
Shwww, still with me?
I tried making a query for the report so I can pull information from several of the linked tables into the report like I need. The query has no criteria, as I thought I could pass along the AutoID to it before the report is opened using in the 'where condition' field:
[Query]![qrytest]![AutoID]=[Forms]![frmInfraction]![tbxAutoID]
It didn't work. So...after the record is saved in a form, how can I pass along that record's auto id to a query, which is then used to populate a report that opens?
Thank you, as always.
I've followed the endless Google results on how to do this, and I've come close but I am either doing something wrong or my setup doesn't work for the directions I have found. I have a form that is used for data entry only, with a button/macro that saves the record, closes the form, and is supposed to open a report on the record just saved.
Here is how the database is setup: There is the main table for recording incidents (the form mentioned above saves new records to this table). There are then a few other tables that link to this main table. For example, in the main table is a field for store id that is linked to a table with the store's id (PK) and the store's name. Then I have the report I want to open and review the latest saved record with, and its data source is set to the main table.
Here is what I have tried. With the button on the data entry form, I have set a macro to OpenReport, the correct report assigned, and then in the 'where condition' I have [AutoID]=[Forms]![frmInfraction]![tbxAutoID]. The first AutoID is a field in the main table, and the tbxAutoID is the control on the form with the saved record's auto id number.
This APPEARS to work; however, the report shows the store's code (because that is what is stored in the main table) and not the store's name (which is linked from the main table). Meaning: this way only seems to allow me to create a report off the fields of the underlining table, and not allow controls on the report that are linked of the underlining fields.
Shwww, still with me?
I tried making a query for the report so I can pull information from several of the linked tables into the report like I need. The query has no criteria, as I thought I could pass along the AutoID to it before the report is opened using in the 'where condition' field:
[Query]![qrytest]![AutoID]=[Forms]![frmInfraction]![tbxAutoID]
It didn't work. So...after the record is saved in a form, how can I pass along that record's auto id to a query, which is then used to populate a report that opens?
Thank you, as always.