Results 1 to 4 of 4
  1. #1
    accessnoob91 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2013
    Posts
    2

    Combo Boxes, Macro Help Please! :)

    Hi guys,

    Sorry if there's some introduction page I'm meant to fill out before posting but I'm in some strife with this problem



    So basically I have to create a Decision support system (DSS) using access as a university project. I've decided to create this DSS based on a car rental company fleet with the following attributes - manufacturer, model, seating capacity, baggage capacity and vehicle type. What I tried originally was to create multiple queries against this table to filter out say all hatchbacks, or all vehicles with a baggage capacity of more than 3 etc. However what I ended up doing was creating individual tables listing all possibilities (I only have 10 vehicles so it wasn't too many tables to write out). So that's the background.

    The problem lies in macro's and combo boxes. So basically the DSS has to involve some sort of user input hence why I used combo boxes to allow a client select and input what they are after i.e. the database will ask "how many passengers do you have" and the combo box will have answers from 1-5 and the idea is to then remember this answer and grab the matching table to present to the client. This is all well and good however it gets complicated as you make it a step by step procedure. My system will firstly ask, how may passengers, then how much baggage and then the preferred vehicle type. On the last form, when the user hits continue, I've macrod that button to have an "If" statement which basically states if the user selects x amount of passengers and baggage and vehicle abc then grab xyz table.. Following still? I'll attach screen shots to explain better.

    Now to get to the grunt of the problem. Basically, while the first query will fetch the appropriate table no problems, each subsequent line of code I write after in the macro section essentially doesn't work. When the continue button is pressed on the last form, access will always run the first line of macro but not the subsequent line even though the parameters are not met by the first macro but they are met by the second.

    Click image for larger version. 

Name:	combo.jpg 
Views:	8 
Size:	58.6 KB 
ID:	12048 Here's an example of my combo box. This is the last form I refer to, after hitting continue on this form, the idea is that the database will remember the two previous answers and return the correct table.

    Click image for larger version. 

Name:	macro.jpg 
Views:	7 
Size:	49.5 KB 
ID:	12049Here's the macro code that relates to the button "continue" on the form above. My plan was to write a new line of code every time until all possibilities had been achieved. However the issue is that despite there being two codes there (the only difference is the 1 and 2 on the end of the code) only the first one gets applied. Am I incorrectly coding this?..

    Click image for larger version. 

Name:	table.jpg 
Views:	6 
Size:	72.5 KB 
ID:	12050Lastly here's the table that I want to be returned to the user based on the answers. This table actually relates directly to the first macro line in the above image.

    Guys, I really appreciate it if you've made it this far. I know it's a long winded question but I really have no alternatives, I've been at this assignment since I've got it and the curriculum of my degree is retarded and despite the fact I've never done programming or coding during the last 3 years, the uni's decided to give this as an assignment smh.

    Anyway cheers guys, please don't hesitate to ask more questions if it doesn't make sense!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    The data structure doesn't look right to me. I don't use macros, only VBA, but I can sometimes figure out macro issues. If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    accessnoob91 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2013
    Posts
    2
    Hi

    Thanks for the quick reply. I've attached the database. I'm guessing what you mean by incorrect data structure relates to the separation of tables as opposed to one table containing all vehicles to which queries can be applied to that?

    Cheers
    Attached Files Attached Files

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Yes, should combine all those tables to one. Can have another field for Category (the table names) if you think it will be useful, I'm not sure that it would be.

    Use filters to select records. The approach of radio buttons to select filter criteria will require a bunch of VBA code. A simpler approach is parameterized query. Review:

    http://datapigtechnologies.com/flash...tomfilter.html

    http://datapigtechnologies.com/flash...earchform.html

    http://datapigtechnologies.com/flash...mtoreport.html

    Those examples use VBA code but I expect there would be macro equivalents.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 9
    Last Post: 06-04-2014, 10:45 AM
  2. Asking for more help with Combo Boxes
    By djclntn in forum Forms
    Replies: 24
    Last Post: 03-26-2012, 10:45 PM
  3. Combo Boxes on a From
    By donnan33 in forum Access
    Replies: 14
    Last Post: 01-17-2012, 08:19 AM
  4. combo boxes
    By donnan33 in forum Programming
    Replies: 9
    Last Post: 12-22-2011, 01:10 PM
  5. Combo Boxes
    By Duncan in forum Access
    Replies: 9
    Last Post: 10-26-2010, 08:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums