A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Replace form in external mdb



 
 
Thread Tools Display Modes
  #1  
Old September 3rd, 2009, 09:56 AM posted to microsoft.public.access.tablesdbdesign
AndrewDB
external usenet poster
 
Posts: 35
Default Replace form in external mdb

Hi All. I need to replace a form and attached vb procedures situated in an
external mdb using vba. I can use copyobject but as a form with that name
already exists I get an error.

--
Kepior Senso Fumor
  #2  
Old September 3rd, 2009, 01:58 PM posted to microsoft.public.access.tablesdbdesign
Ken Snell [MVP]
external usenet poster
 
Posts: 279
Default Replace form in external mdb

Check out DoCmd.TransferDatabase method in VBA.

--

Ken Snell
MS ACCESS MVP
http://www.accessmvp.com/KDSnell/


"AndrewDB" wrote in message
...
Hi All. I need to replace a form and attached vb procedures situated in an
external mdb using vba. I can use copyobject but as a form with that name
already exists I get an error.

--
Kepior Senso Fumor



  #3  
Old September 8th, 2009, 08:06 AM posted to microsoft.public.access.tablesdbdesign
AndrewDB
external usenet poster
 
Posts: 35
Default Replace form in external mdb

Thanks Ken. If the form already exists in that database I need a message
informing me so that I can respond -Replace? Yes/No. If yes I need to first
delete the original form before copying the new one across.

By the way what does [MVP] stand for?

Best Regards

--
Kepior Senso Fumor


"Ken Snell [MVP]" wrote:

Check out DoCmd.TransferDatabase method in VBA.

--

Ken Snell
MS ACCESS MVP
http://www.accessmvp.com/KDSnell/


"AndrewDB" wrote in message
...
Hi All. I need to replace a form and attached vb procedures situated in an
external mdb using vba. I can use copyobject but as a form with that name
already exists I get an error.

--
Kepior Senso Fumor




  #4  
Old September 10th, 2009, 03:21 AM posted to microsoft.public.access.tablesdbdesign
Ken Snell [MVP]
external usenet poster
 
Posts: 279
Default Replace form in external mdb

You can use code such as this to test if the form is the

Dim aca As Access.Application
Dim frm As Form
Dim intReply As Integer
Set aca = New Access.Application
aca.OpenCurrentDatabase "C:\MyFolder\MyDBmdb"
intReply = vbYes
For Each frm In aca.CurrentProject.AllForms
If frm.Name = "NameOfFormInOtherDB" Then
intReply = MsgBox("Form exists. Do you want to replace it?", _
vbYesNo, "Replace Form?")
Exit For
End If
Next frm
aca.CloseCurrentDatabase
aca.Quit
Set aca = Nothing
If intReply = vbYes Then
DoCmd.TransferDatabase acExport, "Microsoft Access",
"C:\MyFolder\MyDBmdb", _
acForm, "NameOfFormInYourDB", "NameOfFormInOtherDB"
End If


--

Ken Snell
MS ACCESS MVP
http://www.accessmvp.com/KDSnell/


--

Ken Snell
MS ACCESS MVP
http://www.accessmvp.com/KDSnell/




"AndrewDB" wrote in message
...
Thanks Ken. If the form already exists in that database I need a message
informing me so that I can respond -Replace? Yes/No. If yes I need to
first
delete the original form before copying the new one across.

By the way what does [MVP] stand for?

Best Regards

--
Kepior Senso Fumor


"Ken Snell [MVP]" wrote:

Check out DoCmd.TransferDatabase method in VBA.

--

Ken Snell
MS ACCESS MVP
http://www.accessmvp.com/KDSnell/


"AndrewDB" wrote in message
...
Hi All. I need to replace a form and attached vb procedures situated in
an
external mdb using vba. I can use copyobject but as a form with that
name
already exists I get an error.

--
Kepior Senso Fumor






  #5  
Old September 10th, 2009, 03:21 AM posted to microsoft.public.access.tablesdbdesign
Ken Snell [MVP]
external usenet poster
 
Posts: 279
Default Replace form in external mdb

You can use code such as this to test if the form is the

Dim aca As Access.Application
Dim frm As Form
Dim intReply As Integer
Set aca = New Access.Application
aca.OpenCurrentDatabase "C:\MyFolder\MyDBmdb"
intReply = vbYes
For Each frm In aca.CurrentProject.AllForms
If frm.Name = "NameOfFormInOtherDB" Then
intReply = MsgBox("Form exists. Do you want to replace it?", _
vbYesNo, "Replace Form?")
Exit For
End If
Next frm
aca.CloseCurrentDatabase
aca.Quit
Set aca = Nothing
If intReply = vbYes Then
DoCmd.TransferDatabase acExport, "Microsoft Access",
"C:\MyFolder\MyDBmdb", _
acForm, "NameOfFormInYourDB", "NameOfFormInOtherDB"
End If


--

Ken Snell
MS ACCESS MVP
http://www.accessmvp.com/KDSnell/


--

Ken Snell
MS ACCESS MVP
http://www.accessmvp.com/KDSnell/




"AndrewDB" wrote in message
...
Thanks Ken. If the form already exists in that database I need a message
informing me so that I can respond -Replace? Yes/No. If yes I need to
first
delete the original form before copying the new one across.

By the way what does [MVP] stand for?

Best Regards

--
Kepior Senso Fumor


"Ken Snell [MVP]" wrote:

Check out DoCmd.TransferDatabase method in VBA.

--

Ken Snell
MS ACCESS MVP
http://www.accessmvp.com/KDSnell/


"AndrewDB" wrote in message
...
Hi All. I need to replace a form and attached vb procedures situated in
an
external mdb using vba. I can use copyobject but as a form with that
name
already exists I get an error.

--
Kepior Senso Fumor






  #6  
Old September 10th, 2009, 03:43 AM posted to microsoft.public.access.tablesdbdesign
Ken Snell [MVP]
external usenet poster
 
Posts: 279
Default Replace form in external mdb

"AndrewDB" wrote in message
...
By the way what does [MVP] stand for?



MVP is an award from Microsoft for people who are strongly involved in
Microsoft Community.

http://mvp.support.microsoft.com/
https://mvp.support.microsoft.com/profile/Kenneth.Snell

--

Ken Snell
MS ACCESS MVP
http://www.accessmvp.com/KDSnell/



  #7  
Old September 10th, 2009, 03:43 AM posted to microsoft.public.access.tablesdbdesign
Ken Snell [MVP]
external usenet poster
 
Posts: 279
Default Replace form in external mdb

"AndrewDB" wrote in message
...
By the way what does [MVP] stand for?



MVP is an award from Microsoft for people who are strongly involved in
Microsoft Community.

http://mvp.support.microsoft.com/
https://mvp.support.microsoft.com/profile/Kenneth.Snell

--

Ken Snell
MS ACCESS MVP
http://www.accessmvp.com/KDSnell/



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:19 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.