Results 1 to 12 of 12
  1. #1
    Join Date
    Dec 2003
    Posts
    42

    Unanswered: Error when searching for flagged record

    I have created a text box called, ‘txtSettled’ on a Rents form. This Y or N flag is my trap to re-find a customer by searching for rentals from a Main Menu form based on their driving licence number. Only if the driving licence number matches AND the settled flag is set to N would a record be returned, all the rest would be previous settled hires.

    I’ve tried putting the following code into the On Click function of a “Find Rental” button…

    DoCmd.OpenForm "Rents", , , "[DrivingLicenceNumber]='" & txtDrivingLicenceNumber & "' and Settled='N'"

    However, on clicking on the button, it comes up with a parameter box that asks for input?!

    Anyone have any ideas as to how to fix this?

  2. #2
    Join Date
    Nov 2003
    Location
    Netherlands
    Posts
    85

    Re: Error when searching for flagged record

    Originally posted by InNeedOfHelp
    I have created a text box called, ‘txtSettled’ on a Rents form. This Y or N flag is my trap to re-find a customer by searching for rentals from a Main Menu form based on their driving licence number. Only if the driving licence number matches AND the settled flag is set to N would a record be returned, all the rest would be previous settled hires.

    I’ve tried putting the following code into the On Click function of a “Find Rental” button…

    DoCmd.OpenForm "Rents", , , "[DrivingLicenceNumber]='" & txtDrivingLicenceNumber & "' and Settled='N'"

    However, on clicking on the button, it comes up with a parameter box that asks for input?!

    Anyone have any ideas as to how to fix this?
    Just an example with an AND in between. Might help you!

    strCriteria = "[cfg_id] <> " & Me.cfg_id & " AND [cfg_serienr_cve] = '" & Me.inv_cfg_serienr_cve & "'"

  3. #3
    Join Date
    Dec 2003
    Posts
    42
    It already has the AND statement and that is not the problem...

  4. #4
    Join Date
    Nov 2003
    Location
    Netherlands
    Posts
    85
    Originally posted by InNeedOfHelp
    It already has the AND statement and that is not the problem...
    The input box wil appear when your statement is not correct. I think that your quotes are on the wrong place.

  5. #5
    Join Date
    Dec 2003
    Posts
    42
    I still can't get it to work.

    Is calling DoCmd.OpenForm a valid call when you are already on that form?

  6. #6
    Join Date
    Nov 2003
    Location
    Netherlands
    Posts
    85
    Originally posted by InNeedOfHelp
    I still can't get it to work.

    Is calling DoCmd.OpenForm a valid call when you are already on that form?
    You are on the form Rents or are you on an other form?

    If you are on the form Rents then how do you get de value for txtDrivingLicenceNumber ?

    If you ar eon an other form (search) then ther should be an field named txtDrivingLicenceNumber. Then put Me. in front.

  7. #7
    Join Date
    Dec 2003
    Posts
    42
    The button that you click to find the driving licence number is on the Rents form (the same form that contains the driving licence number). I want it so that you input the driving licence number into the driving licence number text box (txtDrivingLicenceNumberRents) and then on clicking the Find Rental button, the rental with the flag of 'N' is found.

  8. #8
    Join Date
    Nov 2003
    Location
    Netherlands
    Posts
    85
    Originally posted by InNeedOfHelp
    The button that you click to find the driving licence number is on the Rents form (the same form that contains the driving licence number). I want it so that you input the driving licence number into the driving licence number text box (txtDrivingLicenceNumberRents) and then on clicking the Find Rental button, the rental with the flag of 'N' is found.

    I think you should try this:

    DoCmd.OpenForm "Rents", , , "[DrivingLicenceNumber]='" & Me.txtDrivingLicenceNumber & "'"

    If this works then the next step is the AND

  9. #9
    Join Date
    Dec 2003
    Posts
    1
    Try this

    DoCmd.OpenForm "Rents", , , "[DrivingLicenceNumber]='" & txtDrivingLicenceNumber & "' and Settled=N"

    I had the same problem and this layout worked.

  10. #10
    Join Date
    Dec 2002
    Location
    Glasgow, UK
    Posts
    100
    take a look at the recordset clone method
    Access XP & WinXP Pro

  11. #11
    Join Date
    Dec 2003
    Posts
    42
    I've just tried your code KBBA and it still displays an input box when the button is clicked!

  12. #12
    Join Date
    Nov 2003
    Location
    Netherlands
    Posts
    85
    Originally posted by InNeedOfHelp
    I've just tried your code KBBA and it still displays an input box when the button is clicked!
    Your problem is the field "txtDrivingLicenceNumber" which isn't recognized and therefor has no value.

Posting Permissions

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