CHR1S Posted January 9, 2013 Posted January 9, 2013 Im generating a report on all assets in a room. I select the building from a combo box, this propagates the next combo box with the rooms relevant to the building. I then pass the room selection to the query - SELECT Assets.AssetID, Assets.AssetDescription, Assets.AssetCategory, Assets.StatusID, Assets.BuildingID, Assets.Building, Assets.Room, Assets.Make, Assets.Model, Assets.ModelNumber, Assets.SerialNumber, Assets.RoomID FROM Assets WHERE (((Assets.RoomID)=[Forms]![Audit Tools]![RoomAudit].[Form]![cboProducts_2])) ORDER BY Assets.RoomID; Now my issue is that "cboProducts_2" displays the descriptive name for the room and not the RoomID needed to generate the results. How can I still select the descriptive name from the combo box but pass the RoomID to the query? I'm positive I have done this before, but for the life of me cant remember (damn you xmas holiday)
Pashers Posted January 9, 2013 Posted January 9, 2013 (edited) I think it might be: [cboProducts_2].value or [cboProducts_2]!value?! Edited January 9, 2013 by Pashers 1
CHR1S Posted January 9, 2013 Author Posted January 9, 2013 Its still not propagating the data in the report. Ill re-do my query tomorrow with a fresh head on! Thanks
Pashers Posted January 10, 2013 Posted January 10, 2013 If you like I can have a quick look through it if you upload it.
CHR1S Posted January 14, 2013 Author Posted January 14, 2013 My room selection CBO now lists the two columns - Room Name and Room ID - column 2 (Room ID) is bound. I have also added some validation to highlight where I'm going wrong. When I select the room and click generate report the query runs and then halts saying there is no data to generate the report. SELECT Assets.AssetDescription, Assets.AssetCategory, Assets.Building, Assets.Room, Assets.Make, Assets.Model, Assets.SerialNumber, Assets.BuildingID, Assets.ModelNumber, Assets.RoomID FROM Assets WHERE (((Assets.RoomID)=[Forms]![Audit Tools]![RoomAudit]![cboProducts_2].Value));
Pashers Posted January 14, 2013 Posted January 14, 2013 Quick trouble shooting: replace: [Forms]![Audit Tools]![RoomAudit]![cboProducts_2].Value with a 'hard value' i.e. type in a value that you expect would work. If this returns the expected results. Then when you press the report button do: MsgBox [Forms]![Audit Tools]![RoomAudit]![cboProducts_2].Value This show a messagebox displaying what the above code will result to. 1
CHR1S Posted January 14, 2013 Author Posted January 14, 2013 Think I found my issue, will feed back shortly
LosOjos Posted January 14, 2013 Posted January 14, 2013 Did you solve it? I seem to remember it being something to do with the "Bound Column" property of the combo box you're using - try increasing/decreasing it by 1 if you still haven't solved it.
CHR1S Posted January 14, 2013 Author Posted January 14, 2013 Ha, what a stupid issue! In my main asset entry form the [RoomID] value wasn't being auto populated when the drop-down CBO's were selected - this, a Key ID, was missing from all further queries! After_Update - RoomID=cboProducts_2.value D'Oh!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now