Thursday, December 31, 2015

My Notes on Microsoft Access

How to open Microsoft Access file in design mode?
Double-clicking the .mdb file while holding the shift key

How to show Navigation Pane?
Press F11
or
File -> Options -> Current Database -> Check the check box "Display Navigation Pane"

How to show these tabs: Create, External data, and Database Tools?
File -> Options -> Current Database -> Check the check box 'Allow Full Menus' in 'Ribbon and Toolbar Options' area

How to show the item menu when right click on it on Navigation Pane?
File -> Option -> Current Database ->  Check both "Allow Default Shortcut Menus" and "Allow Built-in Toolbars"

How to change the View?
On Ribbon select the Home tab and View
or
click View on Quick Access toolbar

How to switch between codes and form?
Press ALT F11

Link table manager:
Use file DSN file
http://office.microsoft.com/en-us/access-help/use-the-upsizing-wizard-HP005273009.aspx

How do I view the SQL for EXISTING queries and edit it in Access?
http://www.gcflearnfree.org/access2013
http://office.microsoft.com/en-us/access-help/introduction-to-queries-HA102749599.aspx
http://office.microsoft.com/en-us/access-help/view-modify-or-copy-a-query-s-sql-statement-mdb-HP005188056.aspx

How to create new file DSN?
Control Panel -> System and Security -> Administrative Tools -> Data Sources (ODBC)
Select "File DSN" and click on "Add" button
Select "SQL Server" on "Create New Data Source" and click "Finish" button
Continue to specify SQL Server and database to connect

Office 2013 developer training (Module 21)
http://dev.office.com/training

Unable to view hidden objects in Microsoft Access 2007
http://answers.microsoft.com/en-us/office/forum/office_2007-access/unable-to-view-hidden-objects-in-microsoft-access/

How to toggle between tabs in Access

http://answers.microsoft.com/en-us/office/forum/office_2007-access/how-to-toggle-between-tabs-in-access/c955f3e0-4ad0-46ca-bbfd-0a0713537c42
Ctrl+F6 will switch between all open tabs (or windows) in the database, regardless of type.

How to view documents in tab
Change Document Windows Option to "Tab Documents" using File -> Privacy Options

Sub-Forms and Sub-Reports

http://www.functionx.com/access/topics/sfsr.htm

Sunday, November 8, 2015

Visual Basic 6 on Windows 8

In case you need to support and maintain Visual Basic 6 application on Windows 7, Windows 8, ...:
  1. Open command windows as administrator 
  2. Create a zero byte file called MSJAVA.DLL in C:\Windows. (Note: This trick does not work with Windows 10. Need to copy a real copy MSJAVA.DLL to C:\Windows\SysWOW64). Read more: http://www.fortypoundhead.com/showcontent.asp?artid=23993 
  3. "robocopy \WindowsXP\System32 \Windows\System32 java* " (These files from Windows XP system)
  4. "robocopy \WindowsXP\System32 \Windows\System32 msjava*"  
  5. Run setup as administrator from the VB6 or Visual Studio 6 installation media 
  6. On compatibility, select "Run program without help" 
  7. Enter product key and hit next until option list. Choose CUSTOM. 
  8. Do NOT select Data Access (Otherwise you cannot install Visual Studio 6 SP 6 later).
  9. The install will go straight through and will request a restart of windows 
  10. After a restart, start your Visual Basic and confirm all works well, advised to set the program to run in administrative mode so it can write to areas of the registry 
  11. Close it down and install the Visual Studio 6 Service Pack 6 components by right click on SetupSP6.exe to run as administrator) 
  12. Once installed, restart VB6 and check the help about box to confirm you see SP6 installed 

Source: 
http://www.fortypoundhead.com/showcontent.asp?artid=23993 http://blogs.msdn.com/b/pareshj/archive/2013/07/16/visual-basic-6-on-windows-8.aspx

Other readings:
VB6: David Platt’s Inside Pitch 
http://blogs.msdn.com/b/msdnmagazine/archive/2014/06/05/10531518.aspx 

Bring back Classic Visual Basic, an improved version of VB6 
http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/3440221-bring-back-classic-visual-basic-an-improved-versi 

Support Statement for Visual Basic 6.0 on Windows Vista, Windows Server 2008, Windows 7, Windows 8 and Windows 8.1
Update: November 2012
http://msdn.microsoft.com/en-us/vstudio/ms788708 

The Silent Majority: Why Visual Basic 6 Still Thrives 
http://msdn.microsoft.com/en-us/magazine/jj133828.aspx 

Installing Visual Basic/Studio 6 on Windows 10
http://blog.danbrust.net/2015/09/14/installing-visual-basic-studio-6-on-windows-10/

Sunday, October 25, 2015

Month of the Holy Rosary

October is the month of the Holy Rosary. I learn how to say a Rosary from my Grandmother when I lived with her. We used to say a Rosary in our family every night or before the Mass at the Church. When I was young, I thought it was a long time to say a Rosary. But it's actually took only 15 minutes. There was a time I did not say a Rosary. I thought saying a Rosary was out of fashion. Reading Bible is a good way.

Later, in my life, everytime I felt desperate, or worry, or sad, or helpless, or anxious I said a Rosary. The first benefit I received immediately is a peace. Both of reading Bible and saying Rosary helped me calm and gave me a hope.

“The Rosary has accompanied me in moments of joy and in moments of difficulty. To it I have entrusted any number of concerns; in it I have always found comfort.” (St. John Paul II, Rosarium Virginis Mariae, http://w2.vatican.va/content/john-paul-ii/en/apost_letters/2002/documents/hf_jp-ii_apl_20021016_rosarium-virginis-mariae.html ) 

Saturday, September 19, 2015

Sirach - Sách Huấn Ca

Sirach (Sách Huấn Ca) or The Wisdom of Ben Sira had many good things about the life that I think every young person, actually everyone, should read. It is one of seven books which are generally not found in any Protestant translation (NASB, NAS, NIV, RSV, etc.)

Here are some verses with difference translations:
Sirach 2:6 (Ecclesiasticus 2:6)
Sirach 3:17 (Ecclesiasticus 3:19)
Sirach 25:3 (Ecclesiasticus 25:5)
Sirach 26:1 (Ecclesiasticus 26:1)
Sirach 30:14 (Ecclesiasticus 30:14)


Sunday, August 2, 2015

Benjamin Franklin's Thirteen Virtues (Mười ba đức tính của Benjamin Franklin)

1. Temperance (Điều độ). Eat not to dullness; drink not to elevation.
2. Silence (Thinh lặng) . Speak not but what may benefit others or yourself; avoid trifling conversation.
3. Order (Ngăn nắp). Let all your things have their places; let each part of your business have its time.
4. Resolution (Quyết tâm). Resolve to perform what you ought; perform without fail what you resolve.
5. Frugality (Tiết kiệm). Make no expense but to do good to others or yourself; i.e., waste nothing.
6. Industry (Chuyên cần). Lose no time; be always employ'd in something useful; cut off all unnecessary actions.
7. Sincerity (Thành thật). Use no hurtful deceit; think innocently and justly, and, if you speak, speak accordingly.
8. Justice (Công bằng). Wrong none by doing injuries, or omitting the benefits that are your duty.
9. Moderation (Ôn hoà). Avoid extremes; forbear resenting injuries so much as you think they deserve.
10. Cleanliness (Sạch sẽ). Tolerate no uncleanliness in body, cloaths, or habitation.
11. Tranquility (Bình tỉnh). Be not disturbed at trifles, or at accidents common or unavoidable.
12. Chastity (Khiết tịnh). Rarely use venery but for health or offspring, never to dullness, weakness, or the injury of your own or another's peace or reputation.
13. Humility (Khiêm tốn). Imitate Jesus and Socrates.

Source: 'The Autobiography of Benjamin Franklin' by Benjamin Franklin

Sunday, July 19, 2015

Report Data Pane is not Visible in Visual Studio

If the Report Data pane is not visible, and not in the View menu:

View -> Report Data
or Ctrl + Alt + D

Sunday, June 28, 2015

Using WHERE with LIKE and ESCAPE syntax

Note to myself. From https://msdn.microsoft.com/en-us/library/ms173545.aspx
USE AdventureWorks2012 ;
GO
SELECT *
FROM Production.ProductPhoto
WHERE LargePhotoFileName LIKE '%greena_%' ESCAPE 'a' ;

Monday, May 25, 2015

Attach Sample DB AdventureWorksLT2012_Data


On this post Error 5120 When Attached Database, the attached database has two files the MDF and the LDF. But if you have only one MDF file, how do you attach?
  1. Download from http://msftdbprodsamples.codeplex.com/releases/view/55330 
  2. Open MSSQL Management Studion as local administrator
  3. Attach the file AdventureWorksLT2012_Data.mdf 
  4. High light the LDF files row to delete and click Ok button at the end

Sunday, April 26, 2015

ROBOCOPY

I did not know this command ROBOCOPY until few months ago. I'm used to XCOPY on Microsoft Windows PC. But this one is better.

Instead using: XCopy D:\Temp C:\Temp /secdykhr
I use: RoboCopy D:\Temp C:\Temp /E /XX /XO /DST /DCOPY:T /R:3 /NP /LOG+:C:\Temp\robocopy.log

On Windows XP, you must download it from Microsoft.

Thursday, March 12, 2015

SoCal Code Camp 2015

Some pictures from Southern California Code Camp in Fullerton last Sunday. This is an event I loved it.
Defensive Programming
 Some Dot Net Tips
Exception Rules

Thank organizers, sponsors, and volunteers. May God bless you all.

Thursday, February 12, 2015

Ngẫm Nghĩ về Cuộc Đời

Đừng bao giờ trách móc bất kỳ ai trong cuộc sống của bạn. 
Người Tốt sẽ cho bạn Hạnh Phúc… 
Người Xấu cho bạn Kinh Nghiệm… 
Người Tồi Tệ nhất cho bạn Bài Học… 
Và… người Tuyệt Vời Nhất sẽ cho bạn Kỷ Niệm.

Đừng hứa khi đang… vui! 
Đừng trả lời khi đang nóng giận! 
Đừng quyết đinh khi đang… buồn! 
Đừng cười khi người khác… không vui! 

Cái gì mua được bằng tiền, cái đó rẻ. 
Ba năm học nói, một đời học cách lắng nghe.
Chặng đường ngàn dặm luôn bắt đầu bằng một bước đi.
Đừng a tòng ghen ghét ai đó, khi mà họ chẳng có lỗi gì với ta. 

Tuy trong rừng có nhiều cây đại thọ cả ngàn năm, nhưng người sống thọ đến 100 tuổi không nhiều. Bạn thọ lắm cũng chỉ sống đến 100 tuổi (tỉ lệ 1 trên 100.000 người). Nếu bạn sống đến 70 tuổi, bạn sẽ còn 30 năm. Nếu bạn thọ 80 tuổi, bạn chỉ còn 20 năm. Vì lẽ bạn không còn bao nhiêu năm để sống và bạn không thể mang theo các đồ vật bạn có, bạn đừng có tiết kiệm quá mức. (trên 50t mừng từng năm, qua 60t mong hàng tháng, tới 70t đếm mỗi tuần, đến 80t đợi vài ngày, được 90t… ngơ ngác một mình với giờ phút dài thăm thẳm!) Bạn nên tiêu những món cần tiêu, thưởng thức những gì nên thưởng thức, tặng cho thiên hạ những gì bạn có thể cho, nhưng đừng để lại tất cả cho con cháu.

Bạn chẳng hề muốn chúng trở nên những kẻ ăn bám. Đừng lo lắng về những gì sẽ xảy ra sau khi bạn ra đi, vì khi bạn đã trở về với cát bụi, bạn sẽ chẳng bị ảnh hưởng bởi lời khen hay tiếng chê bai nữa đâu. Đừng lo lăng nhiều qúa về con cái vì con cái có phần số của chúng và chúng sẽ tự tìm cách sống riêng. Đừng trở thành kẻ nô lệ của chúng. Đừng mong chờ nhiều ở con cái. Con biết lo cho cha mẹ, dù có lòng vẫn quá bận rộn vì công ăn việc làm và các ràng buộc khác nên không thể giúp gì bạn. Các con vô tình thì có thể sẽ tranh giành của cải của bạn ngay khi bạn còn sống, và còn muốn bạn chóng chết để chúng có thể thừa hưởng các bất động sản của bạn.

Các con của bạn cho rằng chuyện chúng thừa hưởng tài sản của bạn là chuyện dĩ nhiên nhưng bạn không thể đòi dự phần vào tiền bạc của chúng.Với những người thuộc lứa tuổi 60 như bạn, đừng đánh đổi sức khoẻ với tài lực nữa.

Bởi vì tiền bạc có thể không mua được sức khoẻ. Khi nào thì bạn thôi làm tiền? và có bao nhiêu tiền là đủ (tiền muôn, tiền triệu hay mấy chục triệu)? Dù bạn có cả ngàn mẫu ruộng tốt, bạn cũng chỉ ăn khoảng 3 lon gạo mỗi ngày; dù bạn có cả ngàn dinh thự, bạn cũng chỉ cần một chỗ rộng 8 mét vuông để ngủ nghỉ ban đêm.Vậy chừng nào bạn có đủ thức ăn và có đủ tiền tiêu là tốt rồi. Nên bạn hãy sống cho vui vẻ. Mỗi gia đình đều có chuyện buồn phiền riêng. Đừng so sánh với người khác về danh vọng và địa vị trong xã hội và con ai thành đạt hơn, nhưng bạn hãy so sánh về hạnh phúc, sức khỏe và tuổi thọ…

Đừng lo nghĩ về những chuyện mà bạn không thể thay đổi vì chẳng được gì, mà lại còn làm hại cho sức khỏe bạn… Bạn phải tạo ra sự an lạc và tìm được niềm hạnh phúc của chính mình. Miễn là bạn phấn chấn, nghĩ toàn chuyện vui và làm những việc bạn muốn mỗi ngày một cách thích thú thì bạn thật đã sống hạnh phúc từng ngày. Một ngày qua là một ngày bạn mất đi, nhưng một ngày trôi qua trong hạnh phúc là một ngày bạn “được”. Khi bạn vui thì bệnh tật sẽ lành; khi bạn hạnh phúc thì bệnh sẽ chóng hết.

Khi bạn vui và hạnh phúc thì bệnh sẽ chẳng đến bao giờ. Với tính khí vui vẻ, với thể thao thể dục thích đáng, thừơng xuyên ra ánh sáng mặt trời, thay đổi thực phẩm đa dạng, uống thuốc bổ vừa phải, hy vọng rằng bạn sẽ sống thêm 20 hay 30 năm tràn trề sức khỏe. Và nhất là biết trân qúy những điều tốt đẹp quanh mình và còn Bạn bè nữa… họ đều làm cho bạn cảm thấy trẻ trung và có người cần đến mình…

Không có họ chắc chắn bạn sẽ cảm thấy lạc lõng, bơ vơ.

Xin chúc bạn mọi điều tốt đẹp nhất.

Tác giả bài viết: Khuyết Danh

Thursday, January 15, 2015

Resolution for 2015

Try to do my best what Pope Francis suggested to Vatican employees on December 22, 2014.

Below is the English translation by ZENIT:

It was pride that transformed angels into devils; it is humility that renders men like the angles (Saint Augustine).
...
Therefore I exhort you:
  1. To take care of your spiritual life, your relation with God, because this is the vertebral column of all that we do and of all that we are. A Christian who does not nourish himself with prayer, the Sacraments and the Word of God, inevitably withers and dries up. Take care of the spiritual life;
  2. To take care of your family life, giving your children and your dear ones not only money but, above all, time, attention and love;
  3. To take care of your relations with others, transforming the faith into life and words into good works, especially towards the neediest;
  4. To take care of your speech, purifying your tongue from offensive words, from vulgarities and from worldly decadent language;
  5. To take care of wounds of the heart with the oil of forgiveness, forging persons who have wounded us and medicating the wounds we have caused others;
  6. To take care of your work, completing it with enthusiasm, humility, competence, passion, with a spirit that is able to thank the Lord;
  7. To rid yourselves of envy, concupiscence, hatred and negative sentiments that devour our interior peace and transform us into destroyed and destructive persons;
  8. To rid ourselves of rancor that leads us to revenge, and of sloth that leads us to existential euthanasia, of pointing the finger that leads us to pride, of constant complaining that leads us to despair. I know that sometimes, to keep one’s job, there is talk of someone, to defend oneself. I understand these situations, but that way does not end well. In the end we will all be destroyed among ourselves, and this we must not do, it is of no use. Rather, we should ask the Lord for the wisdom to be able to bite our tongue in time, not to say insulting words, which then leave your mouth bitter;
  9. To take care of weak brothers: I have seen many beautiful examples among you in this, and I thank you, congratulations! Namely, take care of the elderly, the sick, the hungry, the homeless and strangers because we shall be judged on this;
  10. To take care that Holy Christmas is never a feast of commercial consumerism, of appearance and of useless gifts, or of superfluous waste, but that it is the feast of joy of receiving the Lord in the Crib and in the heart,
To take care -- to take care of so many things, each one of us can think: “What is the thing I must take care of most?” To think this: “Today, I will take care of this.” However, above all take care of the family! The family is a treasure; children are a treasure. A question that young parents can ask themselves: “Do I have time to play with my children, or am I always busy, busy, and have no time for the children?” I leave you with that question. To play with the children: it is so lovely. And this is to sow the future.
...

Read full Pope Francis address at http://www.zenit.org/en/articles/pope-francis-address-to-vatican-employees