設為首頁收藏本站Access中國

Office中國論壇/Access中國論壇

 找回密碼
 注冊

QQ登錄

只需一步,快速開始

返回列表 發(fā)新帖
樓主: tmtony
打印 上一主題 下一主題

[Access本身] Access技巧接龍

[復制鏈接]
11#
發(fā)表于 2004-12-5 21:30:00 | 只看該作者
將秒為單位的如98989.90秒,轉化為:時:分:**.**的形式的函數,如果前面是0則不顯示。unction SecToTime(dblSecond As Double) As String

    SecToTime = Format((Int(dblSecond) / 60 / 60 / 24), "HH:MM:SS")

    If Int(dblSecond) <> dblSecond Then SecToTime = SecToTime & Round(dblSecond - Int(dblSecond), 2)

    SecToTime = IIf(Left(SecToTime, 6) = "00:00:", Mid(SecToTime, 7), IIf(Left(SecToTime, 3) = "00:", Mid(SecToTime, 4), SecToTime))

End Function

12#
發(fā)表于 2004-12-5 23:15:00 | 只看該作者
讀取英語單詞首字母的函數:Function GetWordZM(strEng As String) As String

    Dim i As Integer, Var As Variant

    Var = Split(strEng, " ")

    For i = 0 To UBound(Var)

        GetWordZM = GetWordZM & UCase(Left(Var(i), 1))

    Next

End Function

13#
發(fā)表于 2004-12-6 00:27:00 | 只看該作者
在 ADP 中使用“域聚合函數”的方法

在 Access 幫助中說,ADP 中“域聚合函數”不能引用窗體控件。

不要相信,這是微軟欺騙善男信女的。沒有“域聚合函數”真的非常不方便。

比如:從前有只窗,窗上有只框,名字叫做“窮”。從前有個表,名字叫做“表”,表中有兩列,叫做“雞”和“錢”

MDB 的統(tǒng)計“錢”的方法:變量 = Dsum("錢", "表", "雞=窮")

模糊統(tǒng)計:變量 = Dsum("錢", "表", "雞 Like '*' & 窮 & '*'")

ADP 的統(tǒng)計“錢”的方法:變量 = Dsum("錢", "表", "雞='" & 窮 & "'")

模糊統(tǒng)計:變量 = Dsum("錢", "表", "雞 Like '" & '%' & 窮 & '%' & "'")

其他的如:Davg;Dcount;Dlookup;Dlast…… 用法一樣。

在 ADP 事件中寫“=Sum(a)”再移一移鼠標,點“...”就會彈出“表達式生成器”。





[此貼子已經被作者于2004-12-5 16:31:57編輯過]

14#
發(fā)表于 2004-12-6 08:13:00 | 只看該作者
在一對多的窗體中,父子窗體都有很多計算控件,控件自動計算時,Access非常不穩(wěn)定,經常錯誤退出。

經過試驗,發(fā)現父子窗體的“記錄源”由原來綁定“表”都改為綁定“查詢”后,非常穩(wěn)定,再沒有錯誤發(fā)生。
15#
發(fā)表于 2004-12-7 21:55:00 | 只看該作者
漢字轉拼音函數:HZQP()expression必需的。包含要轉換的字符串。delimiter可選的。用于標識分隔拼音的字符串字符。如果忽略,則使用空格字符(" ")作為分隔符。如果delimiter是一個長度為零的字符串,則返回僅包含一個元素,即完整的 expression字符串。limit可選的。要返回拼音字符數,–1表示返回所有的拼音字符數,1表示返回拼音首字母。Function HZQP(expression As String, Optional delimiter As String = " ", Optional limit As Integer = -1) As String

Dim STR As String, arrWord(400) As String

Dim i As Integer, j As Integer

arrWord(1) = "吖a"

arrWord(2) = "哎ai"

arrWord(3) = "腤an"

arrWord(4) = "骯ang"

arrWord(5) = "凹ao"

arrWord(6) = "八ba"

arrWord(7) = "挀bai"

arrWord(8) = "扳ban"

arrWord(9) = "邦bang"

arrWord(10) = "勹bao"

arrWord(11) = "陂bei"

arrWord(12) = "奔ben"

arrWord(13) = "崩beng"

arrWord(14) = "皀bi"

arrWord(15) = "邊bian"

arrWord(16) = "杓biao"

arrWord(17) = "憋bie"

arrWord(18) = "邠bin"

arrWord(19) = "仌bing"

arrWord(20) = "撥bo"

arrWord(21) = "峬bu"

arrWord(22) = "嚓ca"

arrWord(23) = "猜cai"

arrWord(24) = "飡can"

arrWord(25) = "倉cang"

arrWord(26) = "撡cao"

arrWord(27) = "冊ce"

arrWord(28) = "嵾cen"

arrWord(29) = "噌ceng"

arrWord(30) = "叉cha"

arrWord(31) = "拆chai"

arrWord(32) = "辿chan"

arrWord(33) = "倀chang"

arrWord(34) = "抄chao"

arrWord(35) = "車che"

arrWord(36) = "抻chen"

arrWord(37) = "阷cheng"

arrWord(38) = "吃chi"

arrWord(39) = "充chong"

arrWord(40) = "抽chou"

arrWord(41) = "出chu"

arrWord(42) = "搋chuai"

arrWord(43) = "巛chuan"

arrWord(44) = "刅chuang"

arrWord(45) = "吹chui"

arrWord(46) = "旾chun"

arrWord(47) = "踔chuo"

arrWord(48) = "呲ci"

arrWord(49) = "從cong"

arrWord(50) = "湊cou"

arrWord(51) = "粗cu"

arrWord(52) = "汆cuan"

arrWord(53) = "崔cui"

arrWord(54) = "邨cun"

arrWord(55) = "搓cuo"

arrWord(56) = "咑da"

arrWord(57) = "呆dai"

arrWord(58) = "丹dan"

arrWord(59) = "當dang"

arrWord(60) = "刀dao"

arrWord(61) = "恴de"

arrWord(62) = "燈deng"

arrWord(63) = "仾di"

arrWord(64) = "敁dian"

arrWord(65) = "刁diao"

arrWord(66) = "爹die"

arrWord(67) = "丁ding"

arrWord(68) = "丟diu"

arrWord(69) = "東dong"

arrWord(70) = "剅dou"

arrWord(71) = "嘟du"

arrWord(72) = "耑duan"

arrWord(73) = "垖dui"

arrWord(74) = "噸dun"

arrWord(75) = "多duo"

arrWord(76) = "妸e"

arrWord(77) = "奀en"

arrWord(78) = "兒er"

arrWord(79) = "發(fā)fa"

arrWord(80) = "帆fan"

arrWord(81) = "方fang"

arrWord(82) = "飛fei"

arrWord(83) = "分fen"

arrWord(84) = "豐feng"

arrWord(85) = "仏fo"

arrWord(86) = "紑fou"

arrWord(87) = "夫fu"

arrWord(88) = "旮ga"

arrWord(89) = "該gai"

arrWord(90) = "干gan"

arrWord(91) = "岡gang"

arrWord(92) = "皋gao"

arrWord(93) = "戈ge"

arrWord(94) = "給gei"

arrWord(95) = "根gen"

arrWord(96) = "更geng"

arrWord(97) = "工gong"

arrWord(98) = "勾gou"

arrWord(99) = "估gu"

arrWord(100) = "瓜gua"

arrWord(101) = "乖guai"

arrWord(102) = "關guan"

arrWord(103) = "光guang"

arrWord(104) = "歸gui"

arrWord(105) = "袞gun"

arrWord(106) = "咼guo"

arrWord(107) = "鉿ha"

arrWord(108) = "嗨hai"

arrWord(109) = "佄han"

arrWord(110) = "夯hang"

arrWord(111) = "蒿hao"

arrWord(112) = "訶he"

arrWord(113) = "黒hei"

arrWord(114) = "拫hen"

arrWord(115) = "亨heng"

arrWord(116) = "叿hong"

arrWord(117) = "侯hou"

arrWord(118) = "乎hu"

arrWord(119) = "花hua"

arrWord(120) = "懷huai"

arrWord(121) = "歡huan"

arrWord(122) = "巟huang"

arrWord(123) = "灰hui"

arrWord(124) = "昏hun"

arrWord(125) = "吙huo"

arrWord(126) = "丌ji"

arrWord(127) = "加jia"

arrWord(128) = "戔jian"

arrWord(129) = "江jiang"

arrWord(130) = "艽jiao"

arrWord(131) = "階jie"

arrWord(132) = "巾jin"

arrWord(133) = "坕jing"

arrWord(134) = "冂jiong"

arrWord(135) = "丩jiu"

arrWord(136) = "凥ju"

arrWord(1
16#
發(fā)表于 2004-12-9 01:14:00 | 只看該作者
不用在VBA中調用API,實現文件選取對話框!

http://ctxi.cn/bbs/dispbbs.asp?boardID=5&ID=23272&page=1
17#
發(fā)表于 2004-12-9 04:52:00 | 只看該作者


連這種變量類型都沒,我用的是ACCESS2000

本帖子中包含更多資源

您需要 登錄 才可以下載或查看,沒有帳號?注冊

x
18#
發(fā)表于 2004-12-10 17:39:00 | 只看該作者
請加入一個引用:你可以看看我的引用,是不是比你的多一個!Office 2000 Runtime 的引用!



[此貼子已經被作者于2004-12-10 10:00:51編輯過]

本帖子中包含更多資源

您需要 登錄 才可以下載或查看,沒有帳號?注冊

x
19#
發(fā)表于 2004-12-12 23:31:00 | 只看該作者
更新后即保存記錄 DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
20#
發(fā)表于 2004-12-13 00:45:00 | 只看該作者
'--------============轉二進制函數=============--------'Adapt By:Gnoy'-------------------------------------------------------------------------Private Declare Sub CopyMemory _

    Lib "kernel32" Alias "RtlMoveMemory" _

    (Destination As Any, Source As Any, ByVal length As Long)Public Function ByteArrayAsBin(ByVal b As Variant) As String

    Dim z As Long

    Dim u As Long

    u = UBound(b)

    For z = 0 To u

        ByteArrayAsBin = ByteArrayAsBin & ByteAsBin(b(z))

        If z <> u Then

            If (z + 1) Mod 4 = 0 Then

                ByteArrayAsBin = ByteArrayAsBin & vbNewLine

            Else

                ByteArrayAsBin = ByteArrayAsBin & " "

            End If

        End If

    Next z

End FunctionPublic Function ByteAsBin(ByVal b As Byte) As String

    Dim z As Long

    For z = 7 To 0 Step -1

        ByteAsBin = ByteAsBin & Abs(CLng(CBool(b And (2 ^ z))))

    Next z

End FunctionPublic Function CurrencyAsBin(ByVal c As Currency) As String

    Dim b(7) As Byte

    CopyMemory b(0), c, 8

    CurrencyAsBin = ByteArrayAsBin(b)

End FunctionPublic Function DateAsBin(ByVal d As Date) As String

    Dim b(7) As Byte

    CopyMemory b(0), d, 8

    DateAsBin = ByteArrayAsBin(b)

End FunctionPublic Function DoubleAsBin(ByVal d As Double) As String

    Dim b(7) As Byte

    CopyMemory b(0), d, 8

    DoubleAsBin = ByteArrayAsBin(b)

End FunctionPublic Function IntegerAsBin(ByVal i As Integer) As String

    Dim b(1) As Byte

    CopyMemory b(0), i, 2

    IntegerAsBin = ByteArrayAsBin(b)

End FunctionPublic Function LongAsBin(ByVal l As Long) As String

    Dim b(3) As Byte

    CopyMemory b(0), l, 4

    LongAsBin = ByteArrayAsBin(b)

End FunctionPublic Function SingleAsBin(ByVal s As Single) As String

    Dim b(3) As Byte

    CopyMemory b(0), s, 4

    SingleAsBin = ByteArrayAsBin(b)

End FunctionPublic Function StringAsBin(ByVal s As String) As String

    Dim b() As Byte

    Dim z As Long

    Dim u As Long

    b = StrConv(s, vbFromUnicode)

    StringAsBin = ByteArrayAsBin(b)

End Function

您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則

QQ|站長郵箱|小黑屋|手機版|Office中國/Access中國 ( 粵ICP備10043721號-1 )  

GMT+8, 2024-10-23 06:22 , Processed in 0.121198 second(s), 33 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回復 返回頂部 返回列表