FredixBlog


Just my log about anything I could find enjoyable.



Windows 7: Désactiver l’UAC

author Posted by: admin on date Jan 31st, 2012 | filed Filed under: Computing

Deux clés de registre à changer. Noter les valeurs précédentes, car s’il est possible de réactiver l’UAC, c’est préférable. J’ai trouvé que c’était plus rabide avec l’UAC activée. Par contre, évidemment des drôles de soucis qui nous font préférer l’UAC désactivée.

HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System

UAC activée:
EnableLUA = 1
ConsentPromptBehaviourAdmin = 5

UAC désactivée:
EnableLUA = 0
ConsentPromptBehaviourAdmin = 0

:)

Get Jet Connection String

author Posted by: fredometro on date Jun 5th, 2007 | filed Filed under: MS-Access

Need to connect to an Access database with ADO? Using workgroup security? Here is a function which will return an opened connection to the jet database:

 


Public Function GetJetConnection(strPath As String, _
         Optional strDBPwd As String, _
         Optional strSysDBPath As String, _
         Optional strUserID As String, _
         Optional strUserPwd As String) _
         As ADODB.Connection
   Dim cnnDB As ADODB.Connection
  
   Set cnnDB = New ADODB.Connection
   With cnnDB
      .Provider = "Microsoft.Jet.OLEDB.4.0"
      '.Mode = lngMode
      .Properties("Jet OLEDB:Database Password") = strDBPwd
      .Properties("Jet OLEDB:System Database") = strSysDBPath
      '.Properties("Jet OLEDB:Engine Type") = lngEngineType
      .Open ConnectionString:=strPath, _
            UserID:=strUserID, _
            Password:=strUserPwd
   End With

   Set GetJetConnection = cnnDB
End Function

 

Need an example? Here it is, connecting to the current database:


     Set rs = New ADODB.Recordset
    rs.Open "Select * from <TableName>", _
        GetJetConnection(CurrentDb.Name, , <system DB path>, <user>, <password>), _
        adOpenKeyset, adLockOptimistic

How can I e-mail a file from Microsoft Access?

author Posted by: fredometro on date Apr 22nd, 2004 | filed Filed under: MS-Access

Hello Anna!

Thanks to ask your question at my website. I am pleased to answer to your question:

How can I e-mail a file from Microsoft Access to other people?

Here is a simple function which sends an email with an attachment.


Public Function MailWithAttachment(Recipient as String, Subject as String, Body as String, Attachment as String)
' Start Outlook.
' If it is already running, you'll use the same instance...
Dim olApp As Outlook.Application
Set olApp = CreateObject("Outlook.Application")

' Logon. Doesn't hurt if you are already running and logged on...
Dim olNs As Outlook.NameSpace
Set olNs = olApp.GetNamespace("MAPI")
olNs.Logon

' Send a message to your new contact.
Dim olMail As Outlook.MailItem

Set olMail = olApp.CreateItem(olMailItem)
' Fill out & send message...
olMail.To = Recipient
olMail.Subject = Subject
olMail.Body = Body

olMail.Attachments.Add Attachment

olMail.Send
' Clean up...
'MsgBox "All done...", vbMsgBoxSetForeground
olNs.Logoff
Set olNs = Nothing
Set olMail = Nothing
Set olAppt = Nothing
Set olItem = Nothing
Set olApp = Nothing

End Function

Just paste this function in a module. Make sure you have a reference to ‘Microsoft Outlook 9.0 Object library’ checked in the
‘Tools/References’ menu, reachable from the module.

Test the function from the debug window by typing from instance:


?MailWithAttachment("mailbox@domainname.com"," _
   & "YourSubjectTextHere", " _
   & "YourBodyTextHere", " _
   & "c:\\MyFile.txt")

The parameters are easy:
Recipient = email address to sent your mail TO
Subject = Subject of your message
Body = Body text of your message
Attachment = filename for the attachment

Once the function is finished, you should have an email in your Outlook outbox, ready to be sent next time you check your email.


Warning: include(/home/www/web421/html/phpTraffic/write_logs.php) [function.include]: failed to open stream: No such file or directory in /home/websitef/public_html/fredometro.com/wp-content/themes/blueshadow/footer.php on line 15

Warning: include() [function.include]: Failed opening '/home/www/web421/html/phpTraffic/write_logs.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/websitef/public_html/fredometro.com/wp-content/themes/blueshadow/footer.php on line 15