14 September 2009

AX - Windows Surface - Warehouse Commander

Just found this interesting demonstration of a Windows Surface application which provides the ability to analyse and manage a warehouse with easy fingertips and gestures. In combination with dynamics ax this would be a great tool for visual inteaction with the warehouse management:

http://silverlight.interknowlogy.com/Videos/WarehouseCommander/default.html

04 September 2009

Access - VBA Code - Easy log file craetion

If you need to create log files from VBA Code in Access you can use the following code to manage the logging.
Option Compare Database
Option Explicit

Public Function writeLog(text As String)
    'Logdatei leicht gemacht
    'by c0bRa
    'Variablendeklaration
    Dim fs As Object, f As Object
   
    Set fs = CreateObject("Scripting.FileSystemObject")
    On Error Resume Next
    'Pfad erstellen, falls nicht vorhanden
    MkDir Application.CurrentProject.Path & "\Log\"
    On Error GoTo writeLognummer1
    'Datei öffnen, wenn nicht vorhanden, erstellen
    Set f = fs.OpenTextFile(Application.CurrentProject.Path & "\Log\" & _
                            Format(Date, "yyyy-MM-dd") & ".log", 8, -2)
    GoTo writeLognummer2
 
writeLognummer1:
    On Error GoTo writeLognummer2
    Set f = fs.CreateTextFile(Application.CurrentProject.Path & "\Log\" & _
                              Format(Date, "yyyy-MM-dd") & ".log", True)
writeLognummer2:
    On Error GoTo 0
    If text = "" Then
        f.Write vbCrLf
      Else
        f.Write "«" & Time & "» " & text & vbCrLf
    End If
    f.Close
End Function
This code creates a Folder called Log if it doesn't exist and creates a log file for every day.
You can call the logging from within your code with this short command.
writeLog "Dies ist ein Testtext"
The code is from a guy called c0bRa - thanks for that :)