Results 1 to 7 of 7
  1. #1
    jonrcp
    Guest

    BuildCriteria in runtime

    I have a function called SetReportOptions that uses the Application.BuildCriteria method.The SetReportOptions function does nothing but use the build the Application.BuildCriteria method and returns the results to another function. My application uses the runtime version of MS Access 2000. The SetReportOptions function works fine on some of the computers its installed on but not on others. See function below:
    Any ideas why I (on some computers) get a run time error when the SetReportOptions function is called???

    Public Function SetReportOptions(ByVal strCriteria As String, ByVal intSetOption As Integer) As String

    Dim strSetCriteria As String
    On Error GoTo Err_Handler
    Select Case intSetOption ' Evaluate intSetOption
    Case 1
    'Default Prints all customers with all ship to numbers
    strSetCriteria = Application.BuildCriteria("[ShHdrCustomer]", dbText, "*")
    SetReportOptions = "ALL"
    Exit Function
    Case 2
    'Prints only selected customers

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: BuildCriteria in runtime

    Is it the machines or is the criteria being entered? There are a number of knowledgebase articles on errors resulting from BuildCriteria, but they all seem to be caused by things like spaces in field names or a reserved word used for the expression argument, or the search expression contains a quote or a period. Try finding out exactly what was being entered when an error occurred and then try entering that same expression on one of the machines that "works" and see if you get the same error. If that's the case, you'll need to modify your code.
    Charlotte

  3. #3
    jonrcp
    Guest

    Re: BuildCriteria in runtime

    Thanks for replying Charlotte,
    The BuildCriteria function gets all its criteria from list boxes which contain, (depending on which option button is selected) Account number(s), Ship to number(s) or Territory number(s) etc, which are pulled from tables inside the database. The data is selected and checked in a previous function called GetOptions and it works fine. I have selected the same report with the same options on different computers. Some work fine ,others (more than one) give a runtime error and shut down. All of the computers that have the full blown Access version installed on the computer have no problems at all, it's the computers with the runtime version (but not all of them) that are giving me the error message.
    Someone said to make sure the references are set properly, which I believe they are, but I'm going to check them all out again.
    Any other ideas?

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: BuildCriteria in runtime

    Well, you never posted the exact error message number, so this has to be general. The standard troubleshooting approach would be to first figure out what the differences are between the machines that work and the ones that don't. So look at things like this:

    1. Is the machine a clean installation of Office 2000, with no Office 97 previously installed?

    2. Is the machine an upgrade from Office 97?

    3. Does another version of Office/Access exist on the machine?

    4. Has a runtime Access application ever been installed on the machine.

    5. What version of the Jet engine is being run (msjet40.dll or msjet35.dll, depending on Access version)?

    6. Is VB installed on the machine, and if so, what version?
    Charlotte

  5. #5
    jonrcp
    Guest

    Re: BuildCriteria in runtime

    More Info!
    The Exact Error message is "Execution of this application has stopped due to a run time error. The Application can't continue and will be shut down.
    One obvious difference I've noticed while troubleshooting is, if Office 2000 is installed on the computer everything works OK. Its only on the computers that don't have office 2000 installed were I get the RunTime Error.
    1/ VB is not installed on any of the computers, except mine and it is(MOD 2000 /VBA).
    2/ No other Access run time applications have been installed.
    3/ The Jet version is msjet40.dll

    Hope this makes it clearer.

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: BuildCriteria in runtime

    Aha! Well, if you're only getting the error on machines without Access installed, then it sounds like your setup package is at fault. In building runtime apps, you have to be careful to use only functions that come from redistributable libraries or from libraries built into Office or Windows. Do the machines that fail have any version of Office installed?

    You didn't say at what point the message appeared. Is it as soon as they click on the icon to start it or sometime during the run of the application?
    Charlotte

  7. #7
    jonrcp
    Guest

    Re: BuildCriteria in runtime

    Hi Charlotte!
    Some of the computers that get a run time error have Office 97 installed but most of them only have MS Word 97. All of them have Outlook 2000. The only computers that do work without any errors are the computers with Office 2000 standard installed. The application starts fine, and you can run almost all of the reports without any errors if you run the full report without any options.(One option is selecting a set of customers or a set of products for the report instead of all the customers and all the products)Basically I

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •