برامج

Access Functions [الأرشيف] - برامج نت

المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Access Functions


AlOmmda
09-30-2005, 10:55 AM
سلامٌ عليكم؛
سوف أقوم بوضع بعض الـ Functions التى قمت بكتابتها منذ فتره و التى يمكن أن تٌستخدم فى الـ Visual Basic for Application أو VB و ذللك عندم يسمح لى الوقت.

الـFunction الآولى تقوم بحساب الآيام فى أى شهر للسنه الحاليه و يتم نذاءها كما يلى
DaysOfMonth(2) و سوف تعطى 28 و هو عدد أيام شهر شباط فبراير لعام 2005



Function DaysOfMonth(anyMonth As Byte) As Integer
' De******ion: Computes the days
of any given month of the current year


Dim anyDate As Date
Dim nDays As Integer

anyDate = DateSerial(Year(Date), anyMonth, 1)


' Adding one month to the given date then
calculate the Difference between the two dates
nDays = DateSerial(Year(anyDate), Month(anyDate) + 1, Day(anyDate)) _
- DateSerial(Year(anyDate), Month(anyDate), Day(anyDate))
DaysOfMonth = nDays
End Function
أتمنى أن أكون قدمت لكم شيى مفيدأ
سلام

AlOmmda
09-30-2005, 12:01 PM
Function GetFieldType(anyTable As String, anyField As String) As Variant
' Category:Tables
' De******ion:Gets the type of the Field in the given table
' CreatedOn:30.09.2004

Dim db As Database, tdf As TableDef, i As Byte, currType As Byte
On Error GoTo ERR_
'IsFieldExist = False
Set db = CurrentDb
Set tdf = db.TableDefs(anyTable)
For i = 0 To tdf.Fields.Count - 1
If tdf.Fields(i).Name = anyField Then
currType = tdf.Fields(i).Type
End If
Next
Select Case currType
Case 3 ' Integer
GetFieldType = "n"

Case 4 ' Long Integer
GetFieldType = "n"

Case 8 ' Date
GetFieldType = "d"

Case 10 ' Text
GetFieldType = "t"

Case 12 ' Memo
GetFieldType = "t"

Case Else
GetFieldType = currType
End Select

EXT_:
Set db = Nothing: Set tdf = Nothing
Exit Function

ERR_:
'IsFieldExist =
Resume EXT_
End Function

hillllallll
09-30-2005, 12:35 PM
الحـمد لله و الصلاة و السلام على امام و خاتم النبيئين
الـسلام عـليكم و رحمـة الله و بركاتـه

لا الــه الا الله الذي لا قوي سواه و سبحان الله و الله أكـبر
والله أكــبر و لا حول ولا قوة الا بالله

أخي مشكــور لكن ممكن تحط صور توضحية و الأدوات المستعملة
بالتوفيق ان شاء الله