Right I have the code in place but it will only work first time out look is opened, unless I have a msgbox on the first line and, I cant work out how to make it work with out it, obviously the msgbox isn't code doing any thing but it must be setting focus or some thing, here is the code
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim olMail As Outlook.MailItem
Dim objAtt As Outlook.Attachment
Dim objDestFolder As Object
When I build the statement I want to email and view it in a MsgBox the lines space correctly with the code vbCrLf.However when I send that text out as the body of the email, the spacing is no longer there and its just one big pile of nonsenses. In the MsgBox I see it correctly as:
Tool Box 5 Drawer 3 Tag Number 4 Drawer 2 Tag Number 6 Tool Box 7 Drawer 8 Tag Number 2
But in the Email it comes out as: Tool Box 5 Drawer 3 Tag Number 4 Drawer 2 Tag Number 6 Tool Box 7 Drawer 8 Tag Number 2
I have a query that formats data into a list of personnel who are coming due for refresher training. The query is formatted to provide me all the details that I need to create an outlook task, and assign it to the person. I tried creating a button on my form to create a record set of that query, and then create / assign a task to each person based on the values from the recordset.
Code: Private Sub SendTasks_Button_Click() 'Create the recordset and set it to the appropriate query Dim rst As DAO.Database Dim rstData As DAO.Recordset Set rst = CurrentDb Set rstData = rst.OpenRecordset("SendTasks_qry")
[Code] .....
Basically, the compiler stops at "Dim myOlApp As New Outlook.Application" with the error: "Compile error: User-defined type not defined"
I'm trying to have a command button send info on the form straight to Outlook as a meeting. So far, the code below works apart from the address bit. I need the code to automatically add the same 2 email addresses as recepients everytime.
Error message highlights the red line below with the following message:
Runtime error '438' Object doesn't support this property or method
I'm new to VBA, so don't understand what is wrong here. The reference is set, I've tried different permutations of the "To:" & "Recipients.Add" for the email address with no joy.
Code: Private Sub cmdSend_Click() Dim outApp As Object Set outApp = CreateObject("Outlook.application") Set outmail = outApp.CreateItem(olappointmentitem)
I have a list box contains 10 times . I have UP and Down buttons to move item up and down. My VBA works only if i set listbox multiselect property to 'None'. For the multiselect=simple option it throws error like in valid use of null in this line of code :
sText = lbfNames.Column(0, iIndex)
My VBA
Code:
Private Sub cmdUP_Click() Dim sText As String Dim iIndex As Integer iIndex = lbfNames.ListIndex 'check: only proceed if there is a selected item
I've created a table that is linked to a folder named New within MS Outlook. I've created a form that will read the emails within the table, and manipulate the data into another table. After the manipulated data is inserted into the other table, I'd like to move the email from the New folder in Outlook to another folder named Pending within Outlook.
I've designed access form with one listbox and added 'up' and 'down' buttons to move up and down the selected item in the listbox. i.e from its selected position to one item up when 'up' button clicked and same as one item down when down button is clicked. Any VBA code will do this functionality?
My boss has assigned a task for me to move the details under a field name (eg:[Name]) in table 1 to table2 under another field name (eg [Insured Name]).
Previously, the software I planned to use is Excel, but my boss says Excel cannot handle large data as the computer will be hanging.So,he wants me to use Access to do the programming.I have some programming backgrounds (like C++) but it seems like I hardly understand how Access works! So can any Access expert here teach me how to do so that i won't get fired.
Firstly, We will have the data like this.
Table1
Code: Name | PolicyNo | Age | Benefit --------+----------------+----------+----------- Chris | 123 | 21 | Death Jane | 456 | 34 | TPD Adam | 789 | 55 | DD
Secondly, we let the other staffs to key in which column to be mapped with the other. Manually Key in (both columns).Mapping Table:
Code: Table1 | Table2 --------------+------------------- Name | InsuredName Policy No | Pol_No Benefit | InsuredBenefit Age | InsuredAge
Thirdly, the staff will run the VBA and result would be like this.
Table2
Code: InsureName | Pol_No | InsuredBenefit | InsuredAge --------------+--------------+----------------------+---------------- Chris | 123 | Death | 21 Jane | 456 | TPD | 34 Adam | 789 | DD | 55
As you can see the new table(table2) , field number 3 is the same with the field number 4 in table1. There is something like copy and paste job, but user can decide how the arrangement for the new table is.
I have a database where on the bottom I have kept the record navigation buttons. When I move to the next record is fine, but when it reaches the end and I press once more, it will create a new one. How can I avoid this?
I made a button special for that purpose to creat new record). I guess the best option will be not to show the record navigation and create buttons to go back and forward and avoid that the next press of the button will create new record.
I have a form which has a field called quote directory, this contains the path of the quote documents and sub folders, I also have a field called project directory.
When a quote is confirmed I have it all working so a new folder is created with specfic details like project number etc.What I want to do is move the folder from the quote directory and put it in the newly created folder in the project directory.
i have a form, where a user inputs a account number inputting the account number, then populates all the relevant table fields, into the form for the user to edit.however if there is more than one account, with that account number, how do i get it so they can cycle through on the form?
For whatever reason, this code will move to the last record that was entered in YESTERDAY, but I want it to move to the last record that was entered in TODAY. If I change the code to only records that are dated today, it claims there are no records (EOF), when there clearly are. why the code will not move to the last record of the table, it is only moving to the last record that was entered yesterday.
I'm trying to build a command button to parse each line into a new record of my table [TBLRECORDS].I am able to parse a single line using this code but don't know how to insert the data into the table and loop through for all lines in my [memFile] control
On a form I have a text control [memFile].I populate it by pasting text from the body of an email into it and it is stored in a tables memo field [TBLFILES].[TEXTFILE].Each email can have countless rows of data in this format
H E74 Warranty end not prior to Serv start for XRC Status: M RecordId=897*7756*33*1D1PMB*20140418 H E74 Warranty end not prior to Serv start for XRC Status: M RecordId=897*7916*68*A1C558*20140418
Each line of data will always begin with "H " and each line of text will always have the same character count..For each line in me.memFile I want to create a new table record and populate this way
So I have a table "zztblArticles." Some fields should go to "tblArticles" and values in Tag_ID should go to a lookup table "tblTag" and a junction table "tblArticles_Tags." I'll explain the code I've written below:
Code: Private Sub cmdSubmit_Click()
Dim db As Database Dim strINSERT As String Dim strVALUES As String Dim rszztblArticles As DAO.Recordset
[Code] ....
The first loop through works fine, I get the records uploaded to all tables. The second loop through fails at
Because it can't decide which ID value to use. This is because the value has been duplicated in tblArticles after the code acts on the same record again. It has completely failed to move to the next record in the recordset, despite the .MoveNext before the Loop!
I'm using a form with next record and previous record buttons that works fine but as the size of the database has grown it's clear I need a faster way to move through records.
My solution was to have an advance 10 records at a time button but I'm having problems when reaching the far sides of the records.
For example: If I'm on record 9 and I press go back 10 button then access tries to go to record 0 (which doesn't exist) and brings up and error. The same happens if I try to advance more than total number of records.
I found a solution to this which was to disable the button when the recordcount was less than 10. This works except now if I'm on say record 14 and want to go back to 4, i press the button, i goes back to record 10, the button is disabled so it can't go back further and i get an error.
If I have a field in a tabbed form (the form has pages), can this field be moved from a tab to another programatically?
The form is called "ProjectMain". The field is called "Lenght" and the page (form tab) it is on is "specs1". Sometimes I need to have this field in the page (form tab) "specs2"
I have a form that simply lists the items: DEPARTMENT_NBR and DEPARTMENT_NAME
In the table: DEPARTMENT_TBL
When I edit the field DEPARTMENT_NBR and it is in error (must be between 01 and 99) I want to put out a message in a MSGBOX and SetFocus back on the DEPARTMENT_NBR.
I coded the MSGBOX with vbokonly and then DEPARTMENT_NBR.SetFocus, but after the message displays and enter is hit for the ok the cursor jumps to the DEPARTMENT_NAME on the current line. Is there a way to get the SetFocus to work properly on repeating items like this? I can never seem to get them to perform the same as they do on non-repeating items.
Thanks for your help.
HERE'S THE EXACT CODE: If IsNumeric(DEPARTMENT_NBR) = False Then If DEPARTMENT_NBR <> "00" Then MsgBox "DEPARTMENT NUMBER must between 01 and 99.", vbOKOnly DEPARTMENT_NBR.SetFocus GoTo DEPARTMENT_NBR_EXIT (exits the paragraph skipping other checks) End If End If
Also, is there a way to look at a specific item in a list like that? IE. I want to reference the 3rd row's DEPARTMENT_NBR. Thanks.
I'm trying to catalog these shelves for work. So someone can then search for the item and it will pull up the shelf its on. The shelf has alot on it so I want to set the focus on the item on the shelf. But I'm not too sure how to do that with my search button.
This is the code for my search button:
Private Sub cmdsearch_Click() 'Purpose: Build up the criteria string form the non-blank search boxes, and apply to the form's Filter. 'Notes: 1. We tack " AND " on the end of each condition so you can easily add more search boxes; _ we remove the trailing " AND " at the end. ' 2. The date range works like this: _ Both dates = only dates between (both inclusive. _ Start date only = all dates from this one onwards; _ End date only = all dates up to (and including this one).
At the moment I have a query that returns a result based on what's selected in a combobox.
SELECT ComponentT.ComponentType AS ComponentType FROM ComponentT WHERE (((ComponentT.TotalComponent) Like [Forms]![DeviceF]![D_ComponentNameCmb] & "*"));
Instead of this I want to rewrite the query to return a result based on what the user has selected in a list box of items. How would this query look. Would I need to increment it in a loop checking all entries into the list box as it can vary in size and if so how?
I tried changing the last line to WHERE (((ComponentT.TotalComponent) Like [Forms]![DeviceF]![D_OutputLsb].[ItemsSelected] & "*")); which returned a result just not the right one. Is there something wrong with the syntax?
I am having trouble with a If statement. I am trying to save a record into a table when an item is Selected (highlighted blue) in a list box. Keep in mind that my listbox is set to multiple selections. I have the following code but sometimes it works and sometimes it doest.
The reason why I am trying to get this to work is because when a item is selected I will add it to the table and when an item is deselected I will delete it from a table. See my code and pictures I have attached :
Private Sub list_audits_Click() Dim strsql As String Dim list As String Dim id As String id = Me.User_ID.Value
A client wants to e-mail newsletters using a non-default Outlook account. The code below does everything the client needs except setting the SendUsingAccount. In debug I can see that the correct account is assigned, yet all of my testing results in e-mails where the From line is the default account. The test setup uses my own isolated SMTP server, so when I look at the e-mails sent the sender is the default account. The default account's Sent folder shows the sent mail, which is not what we want.
Code: Sub prepEmail() Dim frm As Form, startDate As Date, endDate As Date Dim rs As DAO.Recordset, strSQL As String, intNewsLetter As Integer Dim rsEmail As DAO.Recordset, rsNewsletters As DAO.Recordset Dim OlApp As Object, ol As Object Dim olMail As Object, olAcct, olAcctTemp
1. open outlook mail; 2. copy the email details into the database; 3. save the attachment into a E: drive location; 4. move the email to another folder.
1,2 and 4 were working fine until I tries to save the attachment and got stuck on the SaveAs line.
Dim Ola As Outlook.Application Dim Nsp As Outlook.NameSpace Dim pf, Inbox, ib, newdest As Outlook.MAPIFolder Dim msg As Outlook.MailItem Dim Atts As Outlook.Attachments