Overwriting a file 
Author Message
 Overwriting a file

I need to allow users to overwrite an access database file.  My code creates
a new file for them (no problem) but when you select an existing DB file in
the common dialog (save as) it dosent overwrite it.  I have overwrite flag
on, and I am killing the old file but it is not working (maybe in the wrong
sequence).

Any help would be greatly appreciated...

Are there any books on this subject?  I have had fruitless searches on the
web for help.  What is this action called?
I treid    "overwrite files"
             "common dialog"
             "save as"

Thanks in advance
Joe



Tue, 28 Oct 2003 22:20:48 GMT  
 Overwriting a file
The Common Dialog does nothing but return the appropriate file name to you.
You are responsible for actually writing the file. What do you mean, "allow
users to overwrite an Access database file"? Are you trying to overwrite the
currently-open database... if so, you can't do that.


Quote:
> I need to allow users to overwrite an access database file.  My code
creates
> a new file for them (no problem) but when you select an existing DB file
in
> the common dialog (save as) it dosent overwrite it.  I have overwrite flag
> on, and I am killing the old file but it is not working (maybe in the
wrong
> sequence).

> Any help would be greatly appreciated...

> Are there any books on this subject?  I have had fruitless searches on the
> web for help.  What is this action called?
> I treid    "overwrite files"
>              "common dialog"
>              "save as"

> Thanks in advance
> Joe



Tue, 28 Oct 2003 22:44:02 GMT  
 Overwriting a file
LL:
Sometimes I even amaze myself as to how blind I am!!
Of course I cant allow them to overwrite the open DB.
OK so having fixed that (thanks)

I am still having trouble with the overwrite of an other than currently
opened DB file..
The overwrite prompt seems to be just that with no action.

here is the button code (duh)

Private Sub cmdNewDatabase_Click()
    On Error GoTo Cancel
    With CommonDialog1
        .InitDir = "\program files\Shopping List"
        .DialogTitle = "Choose a name for your new Shopping List database"
        .Filter = "Shopping List Files (*.mdb)|*.mdb"
        .Flags = &H6&
        .DefaultExt = "mdb"
        .ShowSave
    End With
    If CommonDialog1.FileName = CurrentDB Then
'Current DB is a str var containing the entire path of the currently opened
DB
        MsgBox "This database is currently open. " & vbCrLf & "You cannot
overwrite the open database. ", vbCritical & vbOKOnly, "Cannot Overwrite
Open Database"
        Exit Sub
    Else
'        If Dir(CommonDialog1.FileName) <> "" Then Kill
CommonDialog1.FileName    ' duh this kills the whole sub (only help i have
gotten so far told me to do this)

' What if the CommonDialog1.FileName is a new DB Then I dont want to kill it
either...
             Create_Database.Create_Database (CommonDialog1.FileName)
' Module that creates the DB
             Me.ConnectToDB
' Procedure that connects to the CurrentDB
    End If
Cancel:
End Sub


Quote:
> The Common Dialog does nothing but return the appropriate file name to
you.
> You are responsible for actually writing the file. What do you mean,
"allow
> users to overwrite an Access database file"? Are you trying to overwrite
the
> currently-open database... if so, you can't do that.



> > I need to allow users to overwrite an access database file.  My code
> creates
> > a new file for them (no problem) but when you select an existing DB file
> in
> > the common dialog (save as) it dosent overwrite it.  I have overwrite
flag
> > on, and I am killing the old file but it is not working (maybe in the
> wrong
> > sequence).

> > Any help would be greatly appreciated...

> > Are there any books on this subject?  I have had fruitless searches on
the
> > web for help.  What is this action called?
> > I treid    "overwrite files"
> >              "common dialog"
> >              "save as"

> > Thanks in advance
> > Joe



Tue, 28 Oct 2003 23:57:02 GMT  
 Overwriting a file
Something smells iffy...

I can't for the life of me figure out why you would want to create a new
database file
for any given user.
A database is for holding records. Add/remove a new TABLE for each user
Or do you mean you want users to be able to add or remove records?
Otherwise you are using the database for temporary data,
this is not efficient

Please clarify what you are trying to do.

Jim Millar


Quote:
> The Common Dialog does nothing but return the appropriate file name to
you.
> You are responsible for actually writing the file. What do you mean,
"allow
> users to overwrite an Access database file"? Are you trying to overwrite
the
> currently-open database... if so, you can't do that.



> > I need to allow users to overwrite an access database file.  My code
> creates
> > a new file for them (no problem) but when you select an existing DB file
> in
> > the common dialog (save as) it dosent overwrite it.  I have overwrite
flag
> > on, and I am killing the old file but it is not working (maybe in the
> wrong
> > sequence).

> > Any help would be greatly appreciated...

> > Are there any books on this subject?  I have had fruitless searches on
the
> > web for help.  What is this action called?
> > I treid    "overwrite files"
> >              "common dialog"
> >              "save as"

> > Thanks in advance
> > Joe



Wed, 29 Oct 2003 00:01:25 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Overwrite a File?

2. permanantly deleting/overwriting a file

3. Overwriting wav-files wh

4. Overwriting wav-files when recording.

5. overwrite excel file

6. overwrite newer files only in copy

7. Overwrite existing files

8. Overwritten project files

9. Cannot overwrite local file upon downloading

10. Cannot overwrite local file upon downloading

11. Overwrite existing files using GET

12. overwriting exported file

 

 
Powered by phpBB® Forum Software