Results 1 to 6 of 6
  1. #1
    Star Lounger
    Join Date
    Jun 2001
    Location
    Christchurch, New Zealand
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Docmd.OpenForm (XP SP2/Win2000/XP)

    Hi,

    I'm having a small problem that I've not struck before. I have a summary form containing a list of Doctors. The summary form allows you to open a Doctor's Information using:

    stDocName = "frmDoctor"
    stLinkCriteria = "[DoctorID]=" & Me.DoctorID
    DoCmd.OpenForm stDocName, , , stLinkCriteria

    It works the first time you open the Doctor form, and will work again if you close the Doctor Form and open a new record. However if you leave the Doctor form open and return to the summary and open any other record it will not reopen the Doctor Form and filter the appropriate Doctor Record.

    There are a couple of odd things, I use this elsewhere fine with no problems and those forms when opened shows (filtered) at the bottom of the screen, however when I open the Dr Screen the (filtered) beside the nav buttons does not appear.

    Any help appreciated.

    Thanks in advance
    Tony

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Docmd.OpenForm (XP SP2/Win2000/XP)

    Does the form frmDoctor have code in its On Load or Open event, for example code to change its record source?

  3. #3
    Star Lounger
    Join Date
    Jun 2001
    Location
    Christchurch, New Zealand
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Docmd.OpenForm (XP SP2/Win2000/XP)

    Hi Hans,

    No code setting or altering the record source at all. The record source is set to just the 'tbldoctor' I do use the Open event / Current Event to format controls etc that is all.

    What I did just try is to ceate another test form with just the DoctorID and Dr Name, this form populates fine and behaves as I'd expected in that it opens to each record and also open to each record even if the form is open. This test form also has the {Filtered) next to the Nav buttons which the other doesn't...

    Corrupt form maybe? or is filter somehow being applied but the form not displaying it?

    Cheers
    Tony

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Docmd.OpenForm (XP SP2/Win2000/XP)

    I'm afraid I don't know what could cause the behavior of the original frmDoctor. The easiest way out is to rename or delete it, and to rename the new form you have created to frmDoctor. (Track Name Autocorrect Info should be off)
    If you would like to find out the cause of the problem, you might post a stripped down version of the database with the problem form. See <post#=393395>post 393395</post#> for instructions.

  5. #5
    Star Lounger
    Join Date
    Jun 2001
    Location
    Christchurch, New Zealand
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Docmd.OpenForm (XP SP2/Win2000/XP)

    Thanks for you help Hans,

    I have just commented out the Open events etc and same problem. I renamed and deleted also and same problem. Autocorrect is off.

    I just tied a test and if i force the form to close before opening each time it will open with the correct data being filtered. However the (filtered) next to the nav buttons is not being displayed still???

    I will continue to test, might try importing to another db etc.. if it continues to be a problem will look to strip down and post.

    Once again many thanks
    Tony

  6. #6
    Star Lounger
    Join Date
    Jun 2001
    Location
    Christchurch, New Zealand
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Docmd.OpenForm (XP SP2/Win2000/XP)

    Update: Problem has been identified and resolved.

    It turned out that one of the subforms had an Me.Orderby command in the on open event. When I commented this out the main form now open's correctly each time when a docmd.openform is passed with a filter. Not quite sure what the relationship is/was given that it was a filter that I was applying and not an order by. However this is the only thing I have changed since this problem was found

Posting Permissions

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