This subroutine reads all files where the excel file is located.
Public Sub ReadFiles()
Dim FSO As New FileSystemObject
Dim MyFiles As Folder
Dim MyFile As File
Set MyFiles = FSO.GetFolder(ActiveWorkbook.path) 'the path of the excel file
For Each MyFile In MyFiles.Files
Print MyFile,name
'Do something
Next
End Sub
Friday, March 6, 2015
Convert a csv file to excel file by VBA
Code snippet
This subrountine converts a CSV file to an excel file
Public Sub CSVToXLS(ByVal CSVfilePath As String, ByVal XLSFilePath As String)
Dim FSO As New FileSystemObject
Dim workbookName As String
Dim applicationPath As String
workbookName = ActiveWorkbook.Name
applicationPath = Application.ActiveWorkbook.path
Workbooks.OpenText CSVfilePath, , , xlDelimited, xlDoubleQuote, False _
, True, True, , , , dataTypes
ActiveWorkbook.SaveAs Filename:=XLSFilePath, FileFormat:=xlNormal
ActiveWorkbook.Close
Workbooks.Item(workbookName).Activate
End Sub
This subrountine converts a CSV file to an excel file
Public Sub CSVToXLS(ByVal CSVfilePath As String, ByVal XLSFilePath As String)
Dim FSO As New FileSystemObject
Dim workbookName As String
Dim applicationPath As String
workbookName = ActiveWorkbook.Name
applicationPath = Application.ActiveWorkbook.path
Workbooks.OpenText CSVfilePath, , , xlDelimited, xlDoubleQuote, False _
, True, True, , , , dataTypes
ActiveWorkbook.SaveAs Filename:=XLSFilePath, FileFormat:=xlNormal
ActiveWorkbook.Close
Workbooks.Item(workbookName).Activate
End Sub
Monday, March 2, 2015
Shrink LDF
Code snippet
USE DatabaseName
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE DatabaseName
SET RECOVERY SIMPLE;
GO
-- Shrink the truncated log file to 1 MB.
DBCC SHRINKDATABASE('DatabaseName')
GO
-- Reset the database recovery model.
ALTER DATABASE DatabaseName
SET RECOVERY FULL;
GO
https://msdn.microsoft.com/en-us/library/ms189493(v=sql.90).aspx
USE DatabaseName
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE DatabaseName
SET RECOVERY SIMPLE;
GO
-- Shrink the truncated log file to 1 MB.
DBCC SHRINKDATABASE('DatabaseName')
GO
-- Reset the database recovery model.
ALTER DATABASE DatabaseName
SET RECOVERY FULL;
GO
https://msdn.microsoft.com/en-us/library/ms189493(v=sql.90).aspx
Thursday, February 26, 2015
Copying table records between company in Axapta
code snippet for copying all table records from one company to another
static void CopyTable(Args _args)
{
while select * from table1
{
ttsbegin;
ChangeCompany('COM2')
{
buf2buf(table1, table2);
}
table2.insert();
ttscommit;
}
}
Tuesday, February 17, 2015
AX2012 Warehouse Mobile Devices Portal - Item inquiry
This is a quick 8 steps to inquiry an item quantity in the uspi company of the AX2012 R3 demo data over the warehouse mobile devices portal. Assuming the warehouse mobile device portal has been setup properly.
Go to USPI > Warehouse management > Area page > Setup > Mobile device > Mobile device menu items. Create "Item inquiry" menu item. Choose Indirect as Mode and Item inquiry as Activity code
Go to Warehouse management > Area page > Setup > Mobile device > Mobile device menu
Add menu item "Item inquiry" to the menu
Setup a mobile device login at USPI > Warehouse management > Area page > Setup > Work users > Workers. Create an user Id and reset password if necessary
![]() |
| Add caption |
You can see the menu item "Item inquiry" newly created in the main menu. Choose "Item inquiry"
Only item enabled with "Uses warehouse management process" is available for inquiry.
Enter the item id, the quantity per inventory dimension is displayed after screen refresh.
Wednesday, February 11, 2015
Run SSRS report from code in AX2012 R3
public static void runSSRSReport()
{
SrsReportRunController controller;
controller = new SrsReportRunController();
controller.parmLoadFromSysLastValue(false);
controller.parmReportName("SR_MainAccount.AutoDesign1"); //name of report to print
controller.parmReportContract().parmPrintSettings().landscape(true);
controller.parmReportContract().parmPrintSettings().printMediumType(SRSPrintMediumType::File);
controller.parmReportContract().parmPrintSettings().fileFormat(SRSReportFileFormat::PDF);
controller.parmReportContract().parmPrintSettings().overwriteFile(true);
controller.parmReportContract().parmPrintSettings().fileName(strFmt("\\\\shop3\\AxaptaPDF\\P%1.pdf",ID)); //filename to print pdf to
controller.parmReportContract().parmPrintSettings().fromPage(1);
controller.parmReportContract().parmPrintSettings().toPage(1);
controller.parmReportContract().parmRdlContract().setValue("mi_prisskilt_ItemId",ID); //parameters to send to report
controller.runReport();
}
quote from https://www.linkedin.com/groups/How-can-I-run-SSRS-3793661.S.210858144
Monday, February 9, 2015
AX2012 - Warehouse management II and Warehouse and Transportation management
Error
Storage dimension group Ware uses warehouse management processes that are enabled by the Warehouse and Transportation management configuration key, but the Warehouse management II configuration key is also enabled. This combination is not supported. Choose and enable only one configuration key.
Details explanation
https://kurthatlevik.wordpress.com/2014/05/15/ax-2012-r3-do-not-enable-wms-ii-and-the-new-warehouse-and-transportation-management-in-the-same-installation/
Storage dimension group Ware uses warehouse management processes that are enabled by the Warehouse and Transportation management configuration key, but the Warehouse management II configuration key is also enabled. This combination is not supported. Choose and enable only one configuration key.
Details explanation
https://kurthatlevik.wordpress.com/2014/05/15/ax-2012-r3-do-not-enable-wms-ii-and-the-new-warehouse-and-transportation-management-in-the-same-installation/
Subscribe to:
Posts (Atom)
Applying SMA10/20, SMA20/50 as trading signals
This is the comparison for results before and after applying SMA10/20 and SMA20/50 in the stock trader. Background Trading 3 stock ma...
-
Snes9X is one of the best Android SNES emulators ever made. It is free, no ads, highly customisable. It helps bringing back tons of go...
-
I struggled with the error "The mobile device interface cannot be opened because either the display settings are not configured or the...
-
Background As a seasonal stock trader, it has been a dream for me to have a stock info system suggesting order price. Traditional tec...









