Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 6th, 2003, 05:06 PM
bhervey bhervey is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 1 bhervey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Access From - Saving

I have created a VB Project that uses an Access Application object to modify an existing form in the database. I am able to dynamically add controls to the form. However, I can't get it to save the form. i.e. When I open it, the newly added controls are not there.

Can anyone help with the last step which is to save the form?

Code:
' Create the Application object.
Set loA = CreateObject("Access.Application")

' Open the desired database.
loA.OpenCurrentDatabase msNewDBPathAndFile
loA.Visible = True

' Open the Existing "Template" Form.
loA.DoCmd.OpenForm FORM_NAME__IMAGE_DATA, acDesign
loA.DoCmd.SelectObject acForm, FORM_NAME__IMAGE_DATA

Set loForm = loA.Forms(FORM_NAME__IMAGE_DATA)

' Client and Project labels.
loForm.Controls("lblClientName").Caption = txtClientName
loForm.Controls("lblProjectName").Caption = txtProjectName
.
.
.
Here is where I want to save the form.
I have tried the following:
loA.DoCmd.Save
loA.DoCmd.Close acForm, FORM_NAME__IMAGE_DATA, acSaveYes

Reply With Quote
  #2  
Old December 7th, 2003, 04:50 PM
Emmanuel Emmanuel is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 4 Emmanuel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Smile

Hi,


You have to tell VB which option (acForm) to use with the name of the corresponding form when you use save method otherwise vb doesn't always choose the right object. You can save your form like this :

DoCmd.Save acForm, NameofYourForm

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Access From - Saving


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT