اذهب الي المحتوي
أوفيسنا

زيادة وإنقاص التاريخ أو الوقت بالضغط على مفتاحى + و - بالكيبورد


abo3aesha_2014

الردود الموصى بها

إخوانى الكرام أقوم بعمل برنامج حضور وانصراف وفى نموذج تعديل التوقيع للموظفين عن طريق المسئول أريد جعل التاريخ والوقت يتحركان بالسالب أو الموجب بالضغط على مفتاحى + و - بلوحة المفاتيح

 فهل من طريقة لعمل ذلك ؟؟

1mdb.rar

رابط هذا التعليق
شارك

  • 1 year later...

أرجو من الأفاضل تعريفي بالخطأ في هذا الكود

استخدمته لزيادة وإنقاص الوقت والتاريخ يعمل معي فإذا أغلقت قاعدة البيانات وفتحتها وجربته تظهر لى رسالة خطأ

Private Sub tim_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = 107 Then
tim = tim + 0.041666
ElseIf KeyCode = 109 Then
tim = tim - 0.041666
ElseIf KeyCode = 33 Then
tim = tim + 1
ElseIf KeyCode = 34 Then
tim = tim - 1
End If

End Sub

 

3mdb.rar

رابط هذا التعليق
شارك

وعليكم السلام:smile:

 

بدل tim_KeyDown ، استعمل Form_KeyDown

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = 107 Then
tim = tim + 0.041666
ElseIf KeyCode = 109 Then
tim = tim - 0.041666
ElseIf KeyCode = 33 Then
tim = tim + 1
ElseIf KeyCode = 34 Then
tim = tim - 1
End If

End Sub

 

جعفر

رابط هذا التعليق
شارك

10 ساعات مضت, jjafferr said:

وعليكم السلام:smile:

 

بدل tim_KeyDown ، استعمل Form_KeyDown


Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = 107 Then
tim = tim + 0.041666
ElseIf KeyCode = 109 Then
tim = tim - 0.041666
ElseIf KeyCode = 33 Then
tim = tim + 1
ElseIf KeyCode = 34 Then
tim = tim - 1
End If

End Sub

 

جعفر

للأسف غير فعال 

رابط هذا التعليق
شارك

2 ساعات مضت, abo3aesha_2014 said:

1. استخدمته لزيادة وإنقاص الوقت والتاريخ يعمل معي

2. فإذا أغلقت قاعدة البيانات وفتحتها وجربته تظهر لى رسالة خطأ

1. اذن الكود الذي ارفقته يعمل!!

2. رجاء ارفاق صورة من رسالة الخطأ.

 

جعفر

رابط هذا التعليق
شارك

زر الصفحة لأعلى وزر الصفحة لأسفل ، هذه الازرار محجوزة للأكسس ، 

فأنا غيرت لك الكود علشان تستعمل السهم الاعلى والسهم الاسفل ، بدل الازرار اعلاه:

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

'KeyCode = 33   vbKeyPageUp     PAGE UP key
'KeyCode = 34   vbKeyPageDown   PAGE DOWN key
'KeyCode = 107  vbKeyAdd        PLUS SIGN (+) key
'KeyCode = 109  vbKeySubtract   MINUS SIGN (-) key
'KeyCode = 38   vbKeyUp         UP ARROW key
'KeyCode = 40   vbKeyDown       DOWN ARROW key

  If KeyCode = 107 Then
    tim = tim + 0.041666

  ElseIf KeyCode = 109 Then
    tim = tim - 0.041666

  'ElseIf KeyCode = 33 Then
  ElseIf KeyCode = 38 Then
    tim = tim + 1

  'ElseIf KeyCode = 34 Then
  ElseIf KeyCode = 40 Then
    tim = tim - 1

  End If

End Sub

 

رابط هذا التعليق
شارك

10 ساعات مضت, jjafferr said:

زر الصفحة لأعلى وزر الصفحة لأسفل ، هذه الازرار محجوزة للأكسس ، 

فأنا غيرت لك الكود علشان تستعمل السهم الاعلى والسهم الاسفل ، بدل الازرار اعلاه:


Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

'KeyCode = 33   vbKeyPageUp     PAGE UP key
'KeyCode = 34   vbKeyPageDown   PAGE DOWN key
'KeyCode = 107  vbKeyAdd        PLUS SIGN (+) key
'KeyCode = 109  vbKeySubtract   MINUS SIGN (-) key
'KeyCode = 38   vbKeyUp         UP ARROW key
'KeyCode = 40   vbKeyDown       DOWN ARROW key

  If KeyCode = 107 Then
    tim = tim + 0.041666

  ElseIf KeyCode = 109 Then
    tim = tim - 0.041666

  'ElseIf KeyCode = 33 Then
  ElseIf KeyCode = 38 Then
    tim = tim + 1

  'ElseIf KeyCode = 34 Then
  ElseIf KeyCode = 40 Then
    tim = tim - 1

  End If

End Sub

 

أثقلت على حضرتك أستاذى

لكن للأسف لا شئ يتغير وإلى حضرتك قاعدة البيانات بعد التعديلات التى أضفتها حسب تعليماتك

3mdb.rar

رابط هذا التعليق
شارك

تمام أستاذى الفاضل ، جزاك الله خيرا

لكنى لاحظت فقط أنه يضيف يومين مع الضغطه الواحده على الزر وكذلك يضيف ساعتين بالضغط على الزر الآخر
لكنى تغلبت عليها بهذا التعديل 

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

'KeyCode = 33   vbKeyPageUp     PAGE UP key
'KeyCode = 34   vbKeyPageDown   PAGE DOWN key
'KeyCode = 107  vbKeyAdd        PLUS SIGN (+) key
'KeyCode = 109  vbKeySubtract   MINUS SIGN (-) key
'KeyCode = 38   vbKeyUp         UP ARROW key
'KeyCode = 40   vbKeyDown       DOWN ARROW key

    If KeyCode = 107 Then
        tim = tim + 0.020833
    
    ElseIf KeyCode = 109 Then
        tim = tim - 0.020833

    'ElseIf KeyCode = 33 Then
    ElseIf KeyCode = 38 Then
        tim = tim + 0.5

    'ElseIf KeyCode = 34 Then
    ElseIf KeyCode = 40 Then
        tim = tim - 0.5
    
    End If

End Sub

 

رابط هذا التعليق
شارك

  • 4 weeks later...

UP

هل من الممكن تفعيل زرين مع بعض بمعنى إذا تم الضغط على

مفتاح Ctrl + مفتاح Page Up يزداد التاريخ يوما

وإذا تم الضغط على

مفتاح Ctrl + مفتاح Page Down ينقص التاريخ يوما

4.mdb.rar

رابط هذا التعليق
شارك

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

'KeyCode = 17   vbKeyCtrl       CTRL
'KeyCode = 33   vbKeyPageUp     PAGE UP key
'KeyCode = 34   vbKeyPageDown   PAGE DOWN key
'KeyCode = 107  vbKeyAdd        PLUS SIGN (+) key
'KeyCode = 109  vbKeySubtract   MINUS SIGN (-) key
'KeyCode = 38   vbKeyUp         UP ARROW key
'KeyCode = 40   vbKeyDown       DOWN ARROW key

    Dim intShiftDown As Integer, intAltDown As Integer
    Dim intCtrlDown As Integer

    ' Use bit masks to determine which key was pressed.
    intShiftDown = (Shift And acShiftMask) > 0
    intAltDown = (Shift And acAltMask) > 0
    intCtrlDown = (Shift And acCtrlMask) > 0
    ' Display message telling user which key was pressed.
    'If intShiftDown Then MsgBox "You pressed the SHIFT key."
    'If intAltDown Then MsgBox "You pressed the ALT key."
    'If intCtrlDown Then MsgBox "You pressed the CTRL key."

    If intCtrlDown Then
    
        If KeyCode = 107 Then
            tim = tim + 0.041666
    
        ElseIf KeyCode = 109 Then
            tim = tim - 0.041666

        'ElseIf KeyCode = 17 and 33 Then
        ElseIf KeyCode = 33 Then
            tim = tim + 1

        'ElseIf KeyCode = 17 and 34 Then
        ElseIf KeyCode = 34 Then
            tim = tim - 1
        
        End If
    
    End If

End Sub

.

جعفر

785.1.4.mdb.accdb.zip

  • Like 1
رابط هذا التعليق
شارك

10 ساعات مضت, jjafferr said:

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

'KeyCode = 17   vbKeyCtrl       CTRL
'KeyCode = 33   vbKeyPageUp     PAGE UP key
'KeyCode = 34   vbKeyPageDown   PAGE DOWN key
'KeyCode = 107  vbKeyAdd        PLUS SIGN (+) key
'KeyCode = 109  vbKeySubtract   MINUS SIGN (-) key
'KeyCode = 38   vbKeyUp         UP ARROW key
'KeyCode = 40   vbKeyDown       DOWN ARROW key

    Dim intShiftDown As Integer, intAltDown As Integer
    Dim intCtrlDown As Integer

    ' Use bit masks to determine which key was pressed.
    intShiftDown = (Shift And acShiftMask) > 0
    intAltDown = (Shift And acAltMask) > 0
    intCtrlDown = (Shift And acCtrlMask) > 0
    ' Display message telling user which key was pressed.
    'If intShiftDown Then MsgBox "You pressed the SHIFT key."
    'If intAltDown Then MsgBox "You pressed the ALT key."
    'If intCtrlDown Then MsgBox "You pressed the CTRL key."

    If intCtrlDown Then
    
        If KeyCode = 107 Then
            tim = tim + 0.041666
    
        ElseIf KeyCode = 109 Then
            tim = tim - 0.041666

        'ElseIf KeyCode = 17 and 33 Then
        ElseIf KeyCode = 33 Then
            tim = tim + 1

        'ElseIf KeyCode = 17 and 34 Then
        ElseIf KeyCode = 34 Then
            tim = tim - 1
        
        End If
    
    End If

End Sub

.

جعفر

785.1.4.mdb.accdb.zip

جزاك الله خيرا على اهتمامك

بالفعل تمت تحريك التاريخ بالضغط على المفتاحين معا ، لكن حدثت مشكلة أخري وهي إلغاء تفعيل زري + و - المسئولين عن زيادة وإنقاص الساعات !!

 

وحتى أختصر على حضرتك الطريق فالمطلوب هو 

إذا تم الضغط على

مفتاح Ctrl + مفتاح Page Up يزداد التاريخ يوما

وإذا تم الضغط على

مفتاح Ctrl + مفتاح Page Down ينقص التاريخ يوما

وإذا تم الضغط على

مفتاح Page Up يزداد الوقت ساعة

وإذا تم الضغط على 

مفتاح Page Down ينقص الوقت ساعة

وإذا تم الضغط على

مفتاح + يزداد الدقائق دقيقة

وإذا تم الضغط على

مفتاح - تنقص الدقائق دقيقة

وجزاك الله خيرا على سعة صدرك

رابط هذا التعليق
شارك

منذ ساعه, abo3aesha_2014 said:

مفتاح Ctrl + مفتاح Page Up يزداد التاريخ يوما

مفتاح Ctrl + مفتاح Page Down ينقص التاريخ يوما

مفتاح Page Up يزداد الوقت ساعة

مفتاح Page Down ينقص الوقت ساعة

مفتاح + يزداد الدقائق دقيقة

مفتاح - تنقص الدقائق دقيقة

من وين لي اعرف هذا !!

 

تفضل الكود الجديد

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

'KeyCode = 17   vbKeyCtrl       CTRL
'KeyCode = 33   vbKeyPageUp     PAGE UP key
'KeyCode = 34   vbKeyPageDown   PAGE DOWN key
'KeyCode = 107  vbKeyAdd        PLUS SIGN (+) key
'KeyCode = 109  vbKeySubtract   MINUS SIGN (-) key
'KeyCode = 38   vbKeyUp         UP ARROW key
'KeyCode = 40   vbKeyDown       DOWN ARROW key

    Dim intShiftDown As Integer, intAltDown As Integer
    Dim intCtrlDown As Integer

    ' Use bit masks to determine which key was pressed.
    intShiftDown = (Shift And acShiftMask) > 0
    intAltDown = (Shift And acAltMask) > 0
    intCtrlDown = (Shift And acCtrlMask) > 0
    ' Display message telling user which key was pressed.
    'If intShiftDown Then MsgBox "You pressed the SHIFT key."
    'If intAltDown Then MsgBox "You pressed the ALT key."
    'If intCtrlDown Then MsgBox "You pressed the CTRL key."

    
        If KeyCode = 107 Then
            '+minute
            'PLUS SIGN (+) key
            tim = tim + (1 / 24 / 60)
    
        ElseIf KeyCode = 109 Then
            '-minute
            'MINUS SIGN (-) key
            tim = tim - (1 / 24 / 60)

        ElseIf KeyCode = 33 Then
            '+hour
            'PAGE UP key
            tim = tim + (1 / 24)    '0.041666

        ElseIf KeyCode = 34 Then
            '-hour
            'PAGE DOWN key
            tim = tim - (1 / 24)    '0.041666
            
        ElseIf KeyCode = 33 And intCtrlDown Then
            '+day
            'Ctrl + PAGE UP key
            tim = tim + 1

        ElseIf KeyCode = 34 And intCtrlDown Then
            '-day
            'Ctrl + PAGE DOWN key
            tim = tim - 1
        
        End If
    
    
End Sub

 

جعفر

785.2.4.mdb.accdb.zip

  • Like 1
رابط هذا التعليق
شارك

همم

 

ما كنت ادري ان الزر Ctrl حساس !!

 

اليك الكود بعد لبتجربة


Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

'KeyCode = 17   vbKeyCtrl       CTRL
'KeyCode = 33   vbKeyPageUp     PAGE UP key
'KeyCode = 34   vbKeyPageDown   PAGE DOWN key
'KeyCode = 107  vbKeyAdd        PLUS SIGN (+) key
'KeyCode = 109  vbKeySubtract   MINUS SIGN (-) key
'KeyCode = 38   vbKeyUp         UP ARROW key
'KeyCode = 40   vbKeyDown       DOWN ARROW key

    Dim intShiftDown As Integer, intAltDown As Integer
    Dim intCtrlDown As Integer

    ' Use bit masks to determine which key was pressed.
    intShiftDown = (Shift And acShiftMask) > 0
    intAltDown = (Shift And acAltMask) > 0
    intCtrlDown = (Shift And acCtrlMask) > 0
    ' Display message telling user which key was pressed.
    'If intShiftDown Then MsgBox "You pressed the SHIFT key."
    'If intAltDown Then MsgBox "You pressed the ALT key."
    'If intCtrlDown Then MsgBox "You pressed the CTRL key."

    
        If intCtrlDown Then
            'Ctrl
            If KeyCode = 33 Then
                '+day
                'Ctrl + PAGE UP key
                tim = tim + 1

            ElseIf KeyCode = 34 Then
                '-day
                'Ctrl + PAGE DOWN key
                tim = tim - 1
            End If
            
        ElseIf KeyCode = 107 Then
            '+minute
            'PLUS SIGN (+) key
            tim = tim + (1 / 24 / 60)
    
        ElseIf KeyCode = 109 Then
            '-minute
            'MINUS SIGN (-) key
            tim = tim - (1 / 24 / 60)

        ElseIf KeyCode = 33 Then
            '+hour
            'PAGE UP key
            tim = tim + (1 / 24)    '0.041666

        ElseIf KeyCode = 34 Then
            '-hour
            'PAGE DOWN key
            tim = tim - (1 / 24)    '0.041666
            
        End If
    
    
End Sub

 

جعفر

785.2.4.mdb.accdb.zip

رابط هذا التعليق
شارك

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information