I have a database for which the user can "attach" supporting files. Currently I handle this by putting a button on the form. The button opens the folder related to the current record via windows explorer. The user is then free to open any file contained, or drag and drop new files if needed. It works reasonably well.
But there is no indication when you look at the form if there are any files attached or not.
First, if anyone can point me to a better way to handle this, (it bugs me that there are thousands of folders being created to each hold a file or two), I would appreciate that. The typical attachment is a message dragged and dropped out of Outlook.
Second, assuming I continue doing things this way, I am thinking I would like to add a listbox to the form. When the form moves to a new record, I would populate the list box with the name of any files found. I know how to do that, but to which event would I be attaching this code?
Attachment File Name as it appears in email attachment box
{F54EBDF9-B9B6-4EA1-B56D35DEC50D0F69}.dat (257KB)
When you select open it does retreive the file in PDF.However, our customers are not very likely to open it because of its File Name.I do send the document to PDF file 1st.I am a carpenter by trade just trying to make my business more easier to run from the office and keeping up with the times.I receive emails from Vendors all the time,I am an avid user of Access since 2000, I barely understand VBA code and often copy from samples and/or researched code.
Here is my Code: Private Sub Command198_Click() Dim strToEmailAddress As String
My company wants to store both a digital copy and a hard paper copy of the files in the access database. Because of this I need to figure out a way to show in the reports the paths to the attached files so that people reading the paper versions can locate the corresponding files on the computer in the future. I have been searching the internet for several hours and have come up with nothing. Is there a way to do this?
I have recently upsized an Access database to SQL Server. The .adp is for the most part working fine.
However, when an end user tries to create a duplicate record in one of the Primary key columns of a Form he gets a SQL Server error message as follows:
"Violation of Primary Key constraint. Cannot insert duplicate key in object myTable".
This is obviously not a very useful error message. What would be the best way to ensure that a more useful error message is returned?
I have considered adding code to the "After_Update" event of the cell in question. This however seems long winded. Is there an easier option?
Dim myForenameBefore As String Dim myForenameAfter As String With CurrentDb.OpenRecordset("Names", dbOpenDynaset) Do Until .EOF myForenameBefore = .Fields("Forename") myForenameAfter = Replace(.Fields("Forename"), "Elizh", "Elizabeth") MsgBox myForenameBefore & " " & myForenameAfter .MoveNext Loop .Close End With
So that I can replace any abbreviated names in a table, however I cannot figure out how to put the value of myForenameAfter back into the table replacing the existing data. Must be particularly thick today
I have a form with a number of check boxes. Clicking on the checkboxes carries out a count function which is then displayed. If the count goes above 20 then a message box is displayed telling the user of it. My problem is that once the number is above 20, the message box diplays everytime. I want it to display just once, regardless of how high the number goes. The checkboxes can be ticked in any order.
At present i'm using
On click
If Me.Text1 > 20 Then Msgbox "The number is graeter than 20" End If
The following code only half works. I want to stop an ugly error occuring when primary keys are duplicated. In the following code the error handler picks up and displays a simple message when a user attempts to add duplicate values. BUT if the users adds a record, the record is successfully added followed with the same error message. I think I've put the error handler in the wrong place, but I can't figure out where it should go. Any ideas are much appreciated.
Damon
Private Sub cmdUpdateGoMaths_Click() 'update Go Maths
On Error GoTo error
Dim adors As ADODB.Recordset Dim sSQL As String
' sSQL = "Select * from datGoMaths;"
' Set rsADO = New ADODB.Recordset ' rsADO.Open sSQL, CurrentProject.Connection, adOpenKeyset, adLockBatchOptimistic
sSQL = "dataGoMaths" Set adors = New ADODB.Recordset adors.Open sSQL, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
I need to generate 1 email with 3 attachments from an Access Db. These attachments are canned reports that are generated each week with fresh data.
I've done several searches and found a lot of good information here. Based on what I've read, I decided to output the 3 reports to a folder in My Documents and then automate Outlook to send the message.
I've used the output function to create the 3 files. No Problem, works well.
Then I found this code for automating Outlook. (Pasted below) I can get it to work (following either step 7 or step 8 below) but only if I include the attachment path in the SendMessage command.
Assuming the full paths are: C:My DocumentsReport1.snp C:My DocumentsReport2.snp C:My DocumentsReport3.snp
how do I modify the code to automatically attach all 3 files?
Any ideas? As always, thanks for taking the time to help, BeckieO
Sub SendMessage(Optional AttachmentPath) Dim objOutlook As Outlook.Application Dim objOutlookMsg As Outlook.MailItem Dim objOutlookRecip As Outlook.Recipient Dim objOutlookAttach As Outlook.Attachment
' Create the Outlook session. Set objOutlook = CreateObject("Outlook.Application")
' Create the message. Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg ' Add the To recipient(s) to the message. Set objOutlookRecip = .Recipients.Add("Henny Penny") objOutlookRecip.Type = olTo
' Add the CC recipient(s) to the message. Set objOutlookRecip = .Recipients.Add("Lucky Ducky") objOutlookRecip.Type = olCC
' Set the Subject, Body, and Importance of the message. .Subject = "This is an Automation test with Microsoft Outlook" .Body = "Last test - I promise." & vbCrLf & vbCrLf .Importance = olImportanceHigh 'High importance
' Add attachments to the message. If Not IsMissing(AttachmentPath) Then Set objOutlookAttach = .Attachments.Add(AttachmentPath) End If
' Resolve each Recipient's name. For Each objOutlookRecip In .Recipients objOutlookRecip.Resolve If Not objOutlookRecip.Resolve Then objOutlookMsg.Display End If Next .Send
End With Set objOutlookMsg = Nothing Set objOutlook = Nothing End Sub
7. To test this procedure, type the following line in the Immediate window, and then press ENTER: SendMessage "C:My DocumentsCustomers.txt"
8. To send the message without specifying an attachment, omit the argument when calling the procedure, as follows:SendMessage
I am looking for a way to attach X amount of pictures to a record. I want to use a command button that opens an explorer to choose X amount of files. I don't want to just open a folder because that won't return the file location.
I am trying to find the VBA code that adds attachments currently stored in the database to an email. Currently, I have a button that will email the report refernced on my input form. My attachments are stored in a table, but I have built a query for my attachments that wil filter based off the referenced report on the input form. Below is my VBA code to email a report.
Private Sub Command587_Click() Dim stReport As String Dim stWhere As String Dim stSubject As String Dim NCRNum As String
How to view the file names of attached files in Access 2010 using a Web Database, specifically the Contacts Web Database that is a template in Access.
Currently it only shows one PDF icon for all my PDF files. I would like to be able to view the file names of all the PDFs in the attachment field. While I'm certain this can't be done within the same field as the attachment box (though would be nice), I would think it would be possible to populate another field with this information.
I have experimented with different things with no luck using a new standard database for testing purposes. The closest I've come was using the SubForm/SubReport; it actually gave me the values for the attachment... see in the picture below.
But even then, it did not work and gave a error: Invalid Control Property: Control Source
I am creating a database that needs to store a large number of pictures. I have a component that we're working on that needs 100 photos of specific details taken and stored.
I have created two separate tables.
One that includes four fields, ID, Component Number PhotoType and an attachment field.
The second table has ID,Photo Type and in this table I've coded 100 records detailing the photos I need. This is used as a lookup field for the first table.
What I would Like to accomplish from this point is to be able to add 100 fields onto the form for the user to click on the attachment and then save the specific photo that corresponds. How do i edit the control source of the attachment item on the form so that it is specific to one component number, and one phototype?
I currently have a macro that sets the value of several fields on a "lost focus " event; however there is an error that I would like access to ignore, is there any way to have this macro process this function "On Error Resume Next" ?
When I export my access database to XML I noticed that the XML elements for the table keys contain the key numbers themselves, not the table name (or a chosen field in the table). For an application I am working on, this presents a problem. What I have is:
One table called 'Process' that looks like:
Process instance_idSystem instance IdProcess name 26 24 Two_thread_process
I have another table called "Thread":
Thread _instance_id Process instance_Id Thread instance name 30 26 T1_instance
The access XML export writes out the key values as they appear in the tables. What I would like is for it to put in the ‘process instance name’ instead of the key that points back to the base (process) field. Any pointers on how I could do this?
Does anyone have a recommended way to deal with images (ie. linked to file, OLE object embedded, others I'm not aware of)???
I have a report which summarizes the history of a project. In this report I have a subreport which has task information. As a user enters task information they have the option of associating pictures with the task (ie. prototypes, design images, test setup, etc).
So my data structure is based on: - many projects - each project can have many tasks - each task can have many pictures
My report for each project lists some typical project information and a subreport shows the task details associated with that project along with as many images that are associated with it.
My current system links to files on a network to avoid database size. This works well for storage and form use, until I try to print or preview a report. Then some of my pictures don't show up and I get a message that says images may be too large. My report could conceivably have up to 100 images, but I'm images stop showing up when I have around 15-20 pictures. Pictures files are typically 300 KB.
Is there a better way to show images on a report?????
Hi All, I am rather new to this and I must admit I am getting everything completely wrapped around my head!
I am developing a database that stores technical support requests received and their solutions. I have three main tables :
Problem - stores all the details of the problems received
Client - stores the address details of the client which is then associated with the 'Problem' table
Company - stores the name of the company which is then associated with the 'Client' table. This is a separate table as different clients can work for the same company.
At present, I have a 'problem data entry' form in which I enter all the details of the problem. At the top there is a section where I can do a search for a particular client and company and the details appear in the respective text boxs on the 'problem data entry' form. If the client does not exist, I have a button that I use to open another form which allows the entry of the new client's details ('New Client'). The user can choose which company this client works for by using a combobox. If the company is not already in the database, I have another button for opening a 'New Company' form!
Its all a little convoluted and it does not work particularly well to be honest. When I add a new company, I need to move forward a record and then back in the 'New Company' form in order that the new company information is saved correctly.
The company selection combobox in the form 'New Client' is then updated with the new company name BUT I need to actually open the combobox and select the company name myself for it to work properly! Once again I also need to move forward one record and then back again in order to properly save all the information before I can close the form.
What would be nice is to do a search for the the company in the combobox on the 'New Client' form, if the company is not found, it automatically adds the company to the database whilst updating all the necessary links. Hence getting rid of the 'New Company' form. I would also like to get rid of the problem of having to move forwards a record and then back again.
Any ideas? I find my method to be rather poor, there must be a simpler way of doing this!
On a form i have a textbox to enter a date and multiple command buttons to open other forms. After entering a date value, followed by either a tab or clicking on one of the command buttons, i want to validate the entered date value. If the date is invalid i want to display an error message and the cursor positioned on the textbox field.
The LostFocus event of the textbox is as follows:
Private Sub txtDateField_LostFocus() If Not IsDate(txtDateField.Value) Then MsgBox "Date invalid." txtDateField.SetFocus End If End Sub
If entering an invalid date is followed by a tab, the error is displayed but the cursor is not positioned on the textbox field. If entering an invalid date is followed by clicking on one of the command buttons, the error is displayed but the expected form is opened. How to position the cursor appropriate and how to prevent opening the form?
On a form i have a textbox to enter a date and multiple command buttons to open other forms. After entering a date, either followed by a tab or clicking on one of the command buttons, i want the date validated. In case of an invalid date an error must be displayed and the cursor positioned to the textbox. Therefor the LostFocus event is as follows:
Private Sub txtDateField_LostFocus() If Not IsDate(txtDateField.Value) Then MsgBox "Date invalid." txtDateField.SetFocus End If End Sub
If entering an invalid date is followed by a tab the error is displayed but the cursor is not positioned to the textbox. If entering an invalid date is followed by clicking on one of the command buttons the error is displayed but a form is opened. How to position the cursor correctly and prevent opening of a form?
How do you do an Access/VBE split screen? I want to be able to watch the code execute as I enter data into the form.
I have redesigned a database, essentially building a new one from scratch. I have all of the forms created and they are working beautifully. :) Now, I'm error-handling to create user-friendly messages. I have a superb Access programming book, but it only briefly mentions error handling and doesn't describe at all how to do it. Most of my forms are pretty simple, and I've been able to complete all of the error-handling tasks using the Form Error event as well as coding other events with the error message number. However, the main form is complex and includes a function in a standard code module and a custom sub routine.
I have a button on a Tab that opens an input form to allow user to add a records. The record is indexed to relevant option from the combo bos on main form, so if no choice is made and user clicks add button megbox 'Invalid Use of Null' pops up. However I can't seem to prevent it, even when I've removed the code completely from the method/function. What's going on there? I just want the message box to say, please make a selection or something. Any ideas?
I have written the following Function as part of an Access program:
Public Function TotalWl() As Long Dim sqlWL As String Dim rsWL As Recordset Dim dbWL As Database Dim sendlDate As Date Set dbWL = CurrentDb sqlWL = "SELECT compul FROM qryStatisticsWL WHERE sendDate between 01/09/2004 and 30/10/2004 " 'this is all written on one line because I do not know how to split it in more than 'one lines Set rsWL = dbWL.OpenRecordset(sqlWL, dbOpenSnapshot) If Not rsWL.EOF Then rsWL.MoveLast TotalWl = rsWL.RecordCount End If End Function
When I call this function the result is always 0. The program does not like : WHERE sendDate between 01/09/2004 and 30/10/2004 I have tried: WHERE sendDate >= 01/09/2004 and sendDate <= 30/10/2004 also: WHERE sendDate >= 01/09/2004 and <= 30/10/2004 I also used single quotes, like '01/09/2004 ' But nothing solved the problem. By the way, thee are data between these two dates. Any suggestions how to proceed?