Làm thế nào để View report ở chế độ cố định
Hỏi: Làm thế nào để View report ở chế độ cố định
Trả lời :
Mã: Dim stDocName As String
stDocName = "R01_Du An Moi"
DoCmd.OpenReport stDocName, acPreview
DoCmd.Maximize
DoCmd.RunCommand acCmdZoom75
' Các chế độ zoom khác :
Mã: ' DoCmd.RunCommand acCmdFitToWindow
' DoCmd.RunCommand acCmdZoom10
' DoCmd.RunCommand acCmdZoom25
' DoCmd.RunCommand acCmdZoom50
' DoCmd.RunCommand acCmdZoom75
' DoCmd.RunCommand acCmdZoom100
' DoCmd.RunCommand acCmdZoom150
' DoCmd.RunCommand acCmdZoom200
Nguồn: http://my.opera.com/bvlbp/blog/thu-thuat-acc
Import Dữ Liệu Từ Excel Vào Access
Để nhập mới nội dung một table (trong Access) từ một tập tin Excel, ta có thể dùng một trong những cách sau đây:
1. Chọn File \ Get External Data \ Import từ trình đơn Access. Trên hộp thoại Import, chọn mục Microsoft Excel từ danh sách Files of type, rồi chọn tập tin Excel muốn đưa dữ liệu vào Access và bấm OK. Sau đó, theo từng bước hướng dẫn của Access. Tuy nhiên, dữ liệu luôn luôn được đưa vào một table mới, chứ không đưa vào table có sẵn cấu trúc được.
2. Tạo một macro, rồi trên form vẽ một nút lệnh để chạy macro này. Tuy nhiên, các thông số như TableName, FileName cần phải được gõ sẵn, hoặc phải bổ sung thêm một số “kỹ xảo” nữa rất mất công.
3. Cách khác hay hơn: dùng đối tượng DoCmd, một hình thức sử dụng macro của Access trong VBA. Ví dụ: Tạo form như hình 1, gồm có một textbox (đặt tên txtTapTinExcel), một nút lệnh (có dấu 3 chấm, đặt tên cmdTimTapTin), một nút lệnh (để đọc dữ liệu từ tập tin Excel có tên chứa trong ô txtTapTinExcel, đặt tên cmdDocDuLieuTuExcel) và một ActiveX Control có tên dlgTimTapTin. ActiveX Control này được tạo bằng cách bấm nút More Controls (nút cuối cùng) trên ToolBox, rồi chọn mục Microsoft Common Dialog Control. Lần lượt gõ vào các thủ tục xử lý tình huống OnClick của các nút lệnh cmdDocDuLieuTuExcel và cmdTimTapTin (đoạn mã 1). Bạn lưu ý, thứ tự và tên các cột trong tập tin Excel phải giống như cấu trúc table đã khai báo trong Access.
Đoạn mã 1
Mã: Private Sub cmdTimTapTin_Click()
With dlgTimTapTin
.ShowOpen
txtTapTinExcel = .FileName
End With
End Sub
Mã: Private Sub cmdDocDuLieuTuExcel_Click()
Dim sTenTable As String
sTenTable = "tbNhanVien" ‘ Vñ duå
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, _
sTenTable, txtTapTinExcel, True
End Sub
101 reasons why i love you
101 reasons why i love you
1. I love the way we finish each other’s sentences.
2. I love the way I know you’ll never give up on me.
3. I love the fact that I wouldn’t ever give up on you.
4. I love the way you look at me.
5. I love how beautiful your eyes are.
6. I love the way I can’t imagine a day without you in my life.
7. I love the way if we were ever separated I wouldn’t know how to go on.
8. I love the way we cuddle and watch sunsets together.
9. I love the way we sometimes stay up all night and just talk, then watch the sunrise together.
10. I love how I know you’ll always be there when I need you to be.
11. I love the fact that I will always be there for you too.
12. I love how when I dream of my life partner, the only person that I can see is you.
13. I love how complete I feel when I am with you.
14. I love how our bodies just fit together.
15. I love the way you make me laugh.
16. I love the way you laugh.
17. I love the way you won’t compromise yourself when we are together.
18. I love the way you won’t let me compromise myself.
19. I love your thoughtfulness.
20. I love your tenderness.
21. I love your ability to speak without saying a single word.
22. I love the way we glance at each other across the room and know what each other is thinking.
23. I love the way, how even though we may be miles apart I still feel like you’re right here with me.
24. I love the way you surprise me with the perfect gifts that show you pay attention to me.
25. I love the way you’ll watch a sporting game with me even though you may not be interested in it.
26. I love the way you treat my friends.
27. I love your love for the things that interest me.
28. I love the way you let me live my life freely without jealousy.
29. I love how you demand respect but are not controlling.
30. I love how I would do anything in this world to make you happy.
31. I love how you would do anything in this world to make me happy.
32. I love the way your voice sounds over the phone.
33. I love the way your voice sounds when you whisper sweet nothings in my ear.
34. I love the completeness and oneness I feel when we make love.
35. I love your sensuality.
36. I love how our romance feels like the perfect romance movie.
37. I love how you are my soul mate.
38. I love the way you handle troubled times.
39. I love the way you respect me.
40. I love the way you protect and defend me.
41. I love how you feel when we cuddle.
42. I love the softness of your lips against mine.
43. I love the softness of you lips against my body.
44. I love the feeling of your hair brushing against me when we make love.
45. I love laying in bed at night talking about nothing.
46. I love waking up to find we’ve been cuddling together all night.
47. I love the surprises you leave for me.
48. I love your intelligence.
49. I love your ingenuity.
50. I love your ability to make friends where ever we go.
51. I love your love for life.
52. I love your passion for your hobbies and interests.
53. I love how every time I look at you, you take my breath away.
54. I love how I thank God everyday for bringing someone as wonderful as you into my life.
55. I love the fact you gave me the gift of our children.
56. I love the special moments that we shared that will remain my fondest memories of you and I.
57. I love spending the holidays with the one person I love the most.
58. I love how my heart skips a beat whenever you walk into the room.
59. I love how you love me.
60. I love how I love you.
61. I love the ways you choose to show your affection for me.
62. I love the way you inspire me to be more than I am.
63. I love the way you spark my creativity and imagination.
64. I love the way you make me feel like anything is possible as long as I’m with you.
65. I love your sense of humor.
66. I love the way you make me feel like royalty.
67. I love the way you dress.
68. I love your understated elegance.
69. I love you just the way you are.
70. I love your spontaneity.
71. I love our life together.
72. I love how if I died right now I would be the happiest person alive knowing I found my one true love.
73. I love the fact that we will grow old together.
74. I love your way with words.
75. I love the way you look when your sleeping.
76. I love the way you think you look awful when you first wake up when it is actually then I find you the most beautiful.
77. I love your willingness to share everything and most especially your heart with me.
78. I love your strength of character.
79. I love taking showers together.
80. I love the way you leave me love notes to find whenever you’re gone.
81. I love the way you treat me.
82. I love the way you take care of us.
83. I love your cooking.
84. I love the way you take the time to thank me for doing every day things.
85. I love the way you show your affection when we are around friends and/or family.
86. I love the way you are not scared to show your affection when we are in public.
87. I love your confidence.
88. I love your ability to make me feel better when times are tough.
89. I love the way we make up after a fight.
90. I love how you treat our children.
91. I love the way you support me when I’m off track.
92. I love the way you take the time to show me how much you love me.
93. I love your beautiful hair.
94. I love your body.
95. I love your openness to try new things.
96. I love your ability to talk things through.
97. I love your courage to be you.
98. I love your greatness.
99. I love the fact that you want to be with me and only me.
100. I love how I am and feel when I am with you!
101. I love you for you!
( sưu tầm)
Buộc user chờ 15 phút sau khi đăng nhập sai 5 lần
Question :Thấy các diễn đàn chỉ cho đăng nhạp 5 lần,nếu sai thì 15 phút sau mới cho đang nhập lại.Thế thì mình nghĩ ra ý tương rằng,cái này chúng ta có thể áp dụng trong Form đăng nhập được không.Điều kiện:
Đăng nhập sai 5 lần thì dù có đăng nhập đúng đi chăng nữa cũng không vào đuợc CSDL.
Reply :
Xin giới thiệu bạn hàm Sleep( số miligiây) dùng để delay chương trình
Để dùng hàm nay, bạn phải khai báo API.
Tạo 1 module và khai báo API sau:
Mã: Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Trong form đăng nhập, bạn tạo 1 biến để đếm. Sau mỗi lần nhập pass nó sẽ đếm lên 1.
Mã: dem=dem+1
If Dem mod 5 =0 then
MsgBox "Sai Pass 5 lan, ban phai cho 15 phut moi duoc dang nhap"
Sleep (1800000)
End If
---------------------------------------------------------------------
Bạn cũng có thể lợi dụng timer của Form ( set interval 1000 )để đếm giờ bằng cách tạo 1 biến demgiay. Khi nhập pass sai lần thứ 5, thì demgiay=0.
Trong sự kiện timer , demgiay =demgiay +1
Như vậy. bắt đầu kiểm tra pass, bạn đặt điều kiện:
Mã: If (dem mod 5 =0 ) and (demgiay < 180 =0) then
msgbox " bạn nhap sai pass 5 lan, ban phai doi 15 phut moi nhap lai duoc, thoi gian con lai : " & 180 - demgiay & "giay"
else
' doan code kiem tra pass
dem = dem +1
demgiay=0
End If
Link table từ file Access có password
Hỏi : Tôi xây dựng chương trình có 2 file: 1 file để thực hiện các thao tác trên FORM và xử lý thông tin (DBSYS.mdb) và 1 file để lưu trữ dữ liệu(DBDATA.mdb)
- Để cho người khác không thể vào được các dữ liệu lưu trữ, tôi đặt pass vào file DBDATA.
- Tôi tạo biến về đường dẫn để có thể tùy ý người sử dụng thay đổi thư mục của chương trình. Khi thay đổi thư mục của chương trình, thì sẽ tự tạo lại các link đến các table trong DBDATA.
Vấn đề là: để thực hiện các lệnh link thì phải gõ pass. Nhưng mỗi một lệnh linktable, lại phải gõ pass một lần.
Các PRO xem có cách nào giúp tôi: đặt sẵn và dùng VBA tại file chính (DBSYS) có thể link table từ DBDATA mà không cần phải gõ pass không (chỉ có sử dụng lệnh trong DBSYS mới không yêu cầu pass, còn các hình thức khác đều yêu cầu pass)
Đáp:
Đầu tiên bạn kết nối với file ở dạng exclusive :
Mã: Dim TempDb as Database
Dim P as String ' Password
P= "mypassword"
Set tempDB = OpenDatabase(CurrentProject.Path & "\" & "DBDATA.MDB", True, False, "MS Access;PWD= " & p)
Sau đó xóa pass đi
Mã: tempDB.NewPassword p, ""
tempDB.Close
Tiến hành liên kết table:
Mã: DoCmd.TransferDatabase acLink, "Microsoft Access", CurrentProject.Path & "\" &"DBDATA.MDB", acTable, "TableName", "Tablename"
'Sau đó set password lại cho file Data
Mã: Set tempDB = OpenDatabase(CurrentProject.Path & "\" & "DBDATA.MDB", True, False)
tempDB.NewPassword "", p
tempDB.Close
Set tempDB = Nothing
Chú ý : Khi sử dụng chương trình thì phải unSet Password đi. Và khi sử dụng xong hoặc có lỗi ta sẽ setPassword trở lại:
Bạn tạo thủ tục 1
Mã: Sub setPass(oldPass as String, newPass As String)
Set tempDB = OpenDatabase(CurrentProject.Path & "\" & "DBDATA.MDB", True, False, "MS Access;PWD=" & oldPass)
tempDB.NewPassword oldPass, NewPass
tempDB.Close
End Sub
Như Vậy, khi cần xài dữ liệu, bạn gọi : setPass mypassword, "" mục đích xóa pass của file đi
Và khi sử dụng xong hoặc chương trình có lỗi, bạn nhớ setPass trở lại password gốc setPass "", mypassword
Xem Demo
Chủ đề Mới nhất |
offtopic
-Chuyên mục: Trao đổi Góp ý-Đăng bởi lần cuối: ellahodge-1 Giờ trước-
» Bài trả lời: 0-
» Lượt xem: 1
|
Seattle Storm Introduces ...
-Chuyên mục: Forms-Đăng bởi lần cuối: MichaelWnba-1 Giờ trước-
» Bài trả lời: 0-
» Lượt xem: 1
|
Loyd Nets 29, Storm Grabs...
-Chuyên mục: Chuyện bốn phương-Đăng bởi lần cuối: MichaelWnba-1 Giờ trước-
» Bài trả lời: 0-
» Lượt xem: 2
|
Dòng Thơ Nhạc Trích Đoạn
-Chuyên mục: Góc Thơ -Đăng bởi lần cuối: Nguyễn Thành Sáng-Hôm qua, 01:13 PM-
» Bài trả lời: 3-
» Lượt xem: 40
|
[Demo-Phần 4] Tạo khóa bả...
-Chuyên mục: Thư viện thủ thuật-Đăng bởi lần cuối: ngochuong279-24-04-24, 06:13 PM-
» Bài trả lời: 38-
» Lượt xem: 5,451
|
Trợ giúp về Textbox với c...
-Chuyên mục: Forms-Đăng bởi lần cuối: Nguyên Thông-18-04-24, 10:15 PM-
» Bài trả lời: 16-
» Lượt xem: 5,923
|
In mã vạch tạo từ access ...
-Chuyên mục: Forms-Đăng bởi lần cuối: huyhoang22-15-04-24, 11:25 AM-
» Bài trả lời: 38-
» Lượt xem: 20,782
|
Kết nối bảng từ access A ...
-Chuyên mục: Thủ thuật VBA-Đăng bởi lần cuối: hieunx-11-04-24, 01:23 PM-
» Bài trả lời: 5-
» Lượt xem: 75
|
Lấy dữ liệu từ 1 cột của ...
-Chuyên mục: Query-Đăng bởi lần cuối: ongke0711-09-04-24, 11:34 AM-
» Bài trả lời: 11-
» Lượt xem: 634
|
Quản lý kho bằng Accesss
-Chuyên mục: Thảo Luận Access-Đăng bởi lần cuối: recca123-07-04-24, 11:27 PM-
» Bài trả lời: 38-
» Lượt xem: 1,506
|
Diễn đàn Thống kê |
» Thành viên: 4,484
» Thành viên mới nhất: ellahodge
» Các chủ đề diễn đàn: 9,859
» Các bài viết diễn: 48,440
Thống kê đầy đủ
|
| | | | |