Results 1 to 9 of 9
  1. #1
    Join Date
    Jan 2005
    Posts
    5

    Unanswered: Getting rid of the prompt save window

    Hello all, I hope someone can help me!
    I've got a form that contains several subforms. Two of the subforms, take their SourceObject property value from a Dynamically created table, so every time the Current event is triggered, the application drops both of these tables and creates them again. And I also expand the columns from the subform for the data to be displayed nicely.
    Everything works fine so far. Until I close the form using the Close button, Access prompts to save both tables. I don't want the user to look at that prompt!
    I've tried to do DoCmd.Save on both tables, but Access send an error about the tables being closed.
    Anyone can come up with an answer or link towards solving this issue.
    TIA.

  2. #2
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi

    I do the same thing with a cross tab query created on the fly (which I cannot store as I cannot define the Columns, which vary with filters selection and, therefore, cannot be linked back to the filter control - apparently !?).

    So the query is deleted, redefined and added to the DB and then set as the subformcontrol.SourceObject each time the filters are applied.

    I was also getting this Save dialogue on close, but not if I removed the query before closing the form, ie

    Code:
    Private Sub cmdClose_Click()
    On Error GoTo Err_cmdClose_Click
        
        DoCmd.SetWarnings False
        fsubHolidayMatrix.SetFocus
        CurrentDb.QueryDefs.Delete QueryName
        fsubHolidayMatrix.SourceObject = vbNullString
        
        DoCmd.Close
    
    Exit_cmdClose_Click:
        Exit Sub
    
    Err_cmdClose_Click:
        MsgBox Err.Description
        Resume Exit_cmdClose_Click
        
    End Sub
    It may work not work with a table, but worth a try ?

    As this is a multy user DB with one FE (via Citrix from multiple office locations) the query name has to be unique, so incorporated the User Logon Name. Just in case you have a similar situation.

    This DB has only been implimented this month, so could be some bugs yet !



    MTB

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    nice idea mike,
    but Id suggest intead of using the logon name to make the query unique use the machine ID. Some installations allow the use of multiple logons, but AFAIK no network installatiion allows the use of duplicate machine ID's, or mebbe I haven't come across that particular network from hell (just yet)
    I'd rather be riding on the Tiger 800 or the Norton

  4. #4
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi healdem

    You are correct on every count, but I figured that any one person would not operate two machines at the same time, but could of course leave one and somebody else use it. I figured that the chance of them using the same dabase and that form at the same time was pretty remote - but possible!

    And yes IT do give unique IDs to each PC (and stickers to prove it!) as part of the inventory, so you have shamed me into it, I now use the PC ID in the query name.

    Thanks for the interest.



    MTB

  5. #5
    Join Date
    Jan 2005
    Posts
    5
    Thnks Mike and Heal! I'm definitely trying that. I'd prefer not placing a custom Close Button in the form and let the user close the form with the windows-integrated close button. What event would you say I try catching to be able to delete the tables before closing the form? I've tried Unload and Close, but the prompt appear before these events get triggered.

    Thanks again.

  6. #6
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Eeek!

    please make sure there is a set warnings true in the error trap:
    Code:
    Exit_cmdClose_Click:
        DoCmd.SetWarnings True
        Exit Sub
    If possible avoid the necessity. I rarely have need for dynamic tables and the like but when I do I am usually ok because each user has one working FE per workstation. Do you have multiple users using a single front end or are you creating these tables on the BE?

    EDIT - addition - is it the tables you are being prompted to save or the forms? Does it want to save the schema or the data?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  7. #7
    Join Date
    Jan 2005
    Posts
    5
    Hey Pootle, it seems like are the tables the ones being prompted, since in the screen it looks somthin like: Table: A/Table: B. So I suppose that the tables are the ones to be saved.

  8. #8
    Join Date
    Jan 2005
    Posts
    5
    Got the actual answer!!!! Thanks to all for your valuable contributions. The trick is to set DoCmd.SetWarnings False someplace in the code.... so I get no prompt when closing the form.

  9. #9
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    hope you noticed pootle's remark in #6 about turning warnings on again

    izy
    Last edited by izyrider; 01-20-07 at 03:08.
    currently using SS 2008R2

Posting Permissions

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