All,
I have a procedure which checks the users Outlook Inbox for the
existance of an email from a specific address. If one is found, a question
is asked to the user asking if they wish to allow the database to save the
attachment and import the data. The reason for this is that the network is
extremely slow and the import takes several minutes to complete. During the
import, the database looks as though it is not responding. Giving them the
option to cancel the import stops them being interrupted whilst working.
My problem is that I wish to give the users another option which if they
select it, will import however many mails exist in their Inbox without
prompting them each time it finds a specific mail. This would be the case if
they do not intend to use the database for some time.
I'm a Newbie at VBA so forgive me if it's messy :o(
My code is as follows:
Public Sub CheckInbox(Save Path As String, StatusPart As Integer)
On Error GoTo AutoImportError
Dim mliNew As MailItem
Dim Ns As NameSpace
Dim oOutlook As Outlook.Applica tion
Dim QuestionAuto As String
Set oOutlook = New Outlook.Applica tion
Set Ns = oOutlook.GetNam espace("MAPI")
Set mfrInbox = Ns.GetDefaultFo lder(olFolderIn box)
With mfrInbox
Forms!frm_switc hboard!txt_Inbo xCount = .Items.Count
DoEvents
If .Items.Count = 0 Then 'No mails in Inbox
Forms!frm_switc hboard!txt_Inbo xCount = .Items.Count
Exit Sub 'Quit the routine if no mails exist
Else
.Items.Sort "Received", True
'Go through every email in the Inbox
For Each mliNew In .Items
If mliNew.SenderNa me = "AS400 George" Then 'Mail is one
we're looking for
'A mail is found, check with the user if they want to import it!!!!
QuestionAuto = MsgBox("Intake Manager has found an email in your Inbox which
it needs to import!" & vbNewLine & _
"The database will try now attempt to import the file" & vbCrLf
& vbCrLf & "This may cause the database to stop responding for several
minutes." & vbNewLine & _
"Do you want it to continue?", vbYesNo + vbQuestion, "Import
Check")
If QuestionAuto = vbNo Then
ImportTimer = 0 'Reset the timer
Exit Sub
End If
mliNew.Attachme nts.Item(1).Sav eAsFile SavePath 'Save the
attachment
ImportRatio
If Not IsNull(DLookup( "psku", "tbl_tmp_ratio" )) Then
MsgBox "During the Auto Import proceedure, a ratio
sku was found in the text file" & vbCrLf & _
"that doesn't exist in the database!" & vbCrLf & _
"Please update the ratio sku information now!!" &
vbCrLf & vbCrLf & _
"The database will attempt the import again within
the hour", vbCritical, "New Ratio Sku"
DoCmd.SetWarnin gs False
DoCmd.RunSQL "delete * from tbl_tmp_ratio;" 'Clear the temp ratio
table
DoCmd.SetWarnin gs True
Exit Sub
End If
ImportNewDay 'Run the Import proceedure
mliNew.Delete 'Delete the mail
End If
Next 'Move onto next mail in Inbox
End If
End With
Main_Exit:
Set mliNew = Nothing
Set Ns = Nothing
Set oOutlook = Nothing
Exit Sub
AutoImportError :
MsgBox "An error has occurred with the following details:" & vbNewLine &
_
"Descriptio n: " & Err.Description & vbNewLine & _
"Error Number: " & Err.Number & vbNewLine & vbNewLine & _
"Please report these details to the database administrator"
Resume Main_Exit
End Sub
Dec 10 '05
10 1661
"Mark" <ma*********@nt lworld.com> wrote in message
news:D_******** *******@newsfe2-win.ntli.net... HI Randy, I managed to acheive what I wanted but not probably as you imagined.
As you suggested, I created a form to mimic a MsgBox with my custom buttons. Once the CheckInbox sub was called and an email found, the custom MsgBox
was opened. This form contained a hidden text box which had a default value of ...truncated...
I meant to chime in on this when I first read the post, but forgot. I use an
easy but less elegant method. I use the following.
Fred Zuckerman
Dim I as String
I = Inputbox("Enter your choice" & vbCrLf & _
"1 = Option A" & vbCrLf & _
"2 = Option B" & vbCrLf & _
"3 = Option C")
Select Case I
Case "1"
'do stuff for option 1
Case "2"
'do stuff for option 2
Case "3"
'do stuff for option 3
Case Else
'invalid selection
exit sub
End Select This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Marc Walgren |
last post by:
Greetings
I have an ASP application to enter reservations. There are multiple user
security settings that require some users to have a restricted list of
client in a drop list on a form.
I constructed the following function:
CREATE FUNCTION (@pUserId int)
|
by: Chris Rodriguez |
last post by:
after creating a couple of mediocre sites and talking too much about
them, i've been overwhelmed w/ requests for new sites & site
make-overs. i have a full-time job and i don't have the time or skills
to develop what companies are asking of me. i'd like to capitalize on
this by hiring someone to do all the production once i've sold the
site. i'm not courting anyone who's considering a massive e-commerce
site or anything that extensive, but...
|
by: Jonas Smithson |
last post by:
I'm going to say something now that may seem to completely contradict
a previous post of mine, in which I basically said that taking a "who
cares" attitude about certain browsers (because of their non-standard
CSS rendering) makes no sense.
Well, you have to draw the line *somewhere*... and contradictory or
not, I've decided that I've suffered with Netscape 4 for long enough.
Coding workarounds for its brain-dead CSS rendering has...
|
by: Fendi Baba |
last post by:
The function is called from opencalendar(targetfield). Thanks for any
hints on what could be the problem.
..............................................................
var decimalPointDelimiter = ".";
|
by: Simone |
last post by:
Hello All.
I would like some advice.
What is the best way to make an Access database design not accessible?
Like accessing tables, form design and etc.
Is it a good idea to make a MDE file? What other options do I have?
On more question should all users have their own front end?
Thanks a lot.
| |
by: grocery_stocker |
last post by:
Given:
int main(void) {
char *ptr = "test me";
printf("%s\n", &ptr);
}
Why would the output be
|
by: Miguel Dias Moura |
last post by:
Hello,
I am saving information about each user in Asp.Net 2.0 profile a using
complex type, i.e., a class.
I am using a SQL 2005 database as the profile provider.
I am also saving the published documents of each user using a
<Serializable()> class.
My objective is to be able to:
|
by: HSD |
last post by:
database not allowing multiusers
--------------------------------------------------------------------------------
Background
An ACCESS database containing two tables and three forms has been installed on the network drive. Using the Tools Menu (Security Sub Menu), five users have been added to the USERS group in the database. The Users group has been assigned OPEN/RUN permission for the database object. The DEFAULT RECORD LOCKING...
|
by: scubak1w1 |
last post by:
Hello,
I am wanting a "pretty output" of tabular data generated on the fly and saved in an array (PHP)...
That is, I have a link so users can chart (JpGraph) and download (CSV) tabular data, based on their selections on a query web page and using PHP, etc to pull the data out of a PostgreSQL database.
I have been requested to make ('on the fly') a 'reporting quality' version of the CSV available for download - sort of like you might get...
|
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,...
|
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...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
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();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
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...
| |