473,794 Members | 2,983 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding subform entries

2 New Member
Hi,

I am an experienced VB6 programmer but a novice when it comes to MS Access. I have a form for ECO's (Engineering Change Orders) based on the table ECO, and in it I created a subform that is linked to a table called Attachments. The attachments are files related to the ECO. I used the wizard to do the work of adding the subform. So far, so good. As I cycle through the ECO's, the subform populates with the file attachments.

What I need to do is to be able to add new attachments or delete existing ones. I can delete existing ones by simply selecting the row in the attachments subform and hitting Delete, although this seems a little dangerous. What is the easiest way to add a new attachment? By the way, my attachment table includes the file title and a hyperlink that includes the full path name and file title. I have code to locate another file, as shown below. It's what I do next that has me wondering.

Expand|Select|Wrap|Line Numbers
  1. Dim objCMDlg As Object
  2. Dim strFileName As String
  3. Dim strHelpFile As String
  4. Dim strMethod As String
  5. Dim FileTitle As String
  6. Dim FilePathName As String
  7. Dim sAttachment As String
  8.  
  9. On Error GoTo HandleErr
  10.  
  11. strMethod = "SHOWOPEN"
  12. Set objCMDlg = Forms![ECOForm].ComDialogAttachment
  13. objCMDlg.CancelError = True
  14.  
  15. With objCMDlg
  16. Select Case UCase(strMethod)
  17.  
  18. Case "SHOWOPEN"
  19. ' File Open dialog box
  20. .Filename = "*.*"
  21. .InitDir = "\\network location"
  22. .Filter = "All File(*.*)|*.*"
  23. .ShowOpen
  24. If Len(.Filename) <> 0 Then
  25. FileTitle = .FileTitle
  26. FilePathName = .Filename
  27. sHyperlink = "#" & FilePathName & "#"
  28. End If
  29. End Select
  30. End With
Mar 17 '08 #1
2 1672
FishVal
2,653 Recognized Expert Specialist
Hi, ScottM.

Generally you have at least two ways to add new record:
  • via form positioned to new record
  • direct adding new record to a relevant table(s) using SQL or DAO/ADO recordsets

But you code looks somewhat confusing.
  • In what context it is being executed?
  • Object of what class does [ECOForm].ComDialogAttac hment returns?
  • What is really a need to get the object in such a bizarre way?

Regards,
Fish
Mar 18 '08 #2
ScottM
2 New Member
All that code does is open up a common dialog box and allow me to choose a file to add as an attachment.
Mar 18 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
4247
by: Rob | last post by:
Hi, I have a application in Access 2000.The subform has a few combo boxes.These are for groups,divison ,names and department respectively and each combo box is dependent on the value selected of the preceding combo.It works fine and the requeries are good.My problem is when i scroll the records on the Main form, at times the combo boxes on the subform display the entries and most times the entries are not visible even though the records...
0
1710
by: Larry R Harrison Jr | last post by:
I have Access 97 and a subform which shows scheduling. It shows the current week. There are 3 shifts per day, thus there are 21 entries per week in the table linked to this subform. This table is the "child" in a "parent-child" type of relationship between another table (often called a "one-many" relationship). Its style looks like this: Date Shift Qty Part# 11-9 1 150 999
0
1388
by: Alienz | last post by:
Hey all. if anyone is REALLY bored please help moi. I am new to access stuff and am probably missing something obvious here. I have 2 tables that are linked via "number" in the relationship area. The relationship is many to many. One is a master form and the other I dragged in to be a subform. I also created a child/master link based on the common "number" field. So, it's a generic subform pretty much.
0
306
by: Greg Acuna | last post by:
I've been using Access 2002 for several months and thought I was getting proficient, but at the moment I'm feeling like a moron because I can't get it to do something that seems simple. I have a main table that has most of my database. Then I have a "Groups" table which I want to use to group the main database by a sub-heading. I have a "GroupID" Field in both tables and I have them linked in the Relationships table. When I set up a...
4
1872
by: tlaker10 | last post by:
Access 2000- my form has fields for “name”, “arrival”, “departure” and “site nbr”. Can I make a subform under “name” that keeps a history of all previous entries to arrival/departure/site nbr so that when the main form is changed, the new information is ADDED to the subform? Thanks *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
1
2595
by: RookieDan | last post by:
Greetings fellow Accessers! Im new but in Access, but I have some background in different coding. I have a programme loading customer data into Access belonging to BMW dealers in Europe. Every dealer reports several customers and I have today a query that sorts out how many customer data each BMW dealer sends in to us. The query is also referring to a startdate and enddate (to be filled in in a messagebox) so that i can choose time...
13
4025
by: MLH | last post by:
I have a form, frmVehicleEntryForm. On it is a subform control named frmAddnlOwnrListSubForm. The subform control's source object is frmAddnlOwnrListSubForm. When I click on the subform control, an attempt to SAVE the partially entered record on the main form is attempted. I do not understand where this behavior is coming from or why. Haven't a clue where to look. Anyone familiar with this behaviour? Here's my subform control's Enter...
0
1434
by: vljones | last post by:
Hoping to find a way of entering new data into a combo box which contains a list of items contained in a table. In addition I want to allocate an ID number to entries that are not currently in the list. I have Form with a subform - frmQuotation!frmSubLimits On the subform I have the following fields: txtSubLimit and numSubLimitID
6
2976
by: naschol | last post by:
I am somewhat of a novice and am trying to do a somewhat complicated thing (to me, anyway). What I would like to do is populate the field Entry Fee in the subform (Category Entries table) from a column (ItemFee) in the table Categories. Then, I would like to add that amount to EntryFees in the Entrant table. Am I right to assume that I have currency in the Catgories table, once I have selected an item in the combobox (column)? How would...
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10435
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10213
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9037
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6779
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.