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

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

قام بنشر

نموذج رئيسى اسمة cash

3 نماذج فرعية

Request

subCash

Patient_Cash

REQ  مربع نص غير منضم فى النموذج الرئيسى  CASH

اريد اختصار لهذا الكود او كتابة بشكل افضل

On Error Resume Next

If Me.REQ = "*" Then
Request.SetFocus
DoCmd.GoToRecord , , acNewRec
DoCmd.OpenQuery "Add_Cash Request"
Me.Request.Requery

If DCount("[pcode]", "request", "[pcode]=" & [Forms]![CASH]![Pateint Code] & " and [out_price]>0") Then
Me.Request.Form!Yes_LAB = ChrW(10003)
Else
Me.Request.Form!Yes_LAB = ""
End If
Me.subCash.Requery
Me.Patient_Cash.Requery
Me.Request.Form!Yes_LAB = ChrW(10003)
DoCmd.GoToRecord , , acLast
'------------------------------------------------------------------------------------------------
ElseIf Me.REQ = 0 Then
Request.SetFocus
DoCmd.GoToRecord , , acNewRec
Request.Form!T_Code = 0
Me.Request.Form!IN_price = Me.Request.Form!IN_Lab
Me.Request.Form!Out_price = Me.Request.Form!Out_lab
Me.Request.Form!TName_R = Me.Request.Form!TName
Me.Request.Form!Date_R = Me.Request.Form!DDate

Me.Request.Form!T_Code.SetFocus

Me.Request.Form!T_Code.SetFocus
 DoCmd.GoToRecord , , acNewRec
Me.subCash.Requery
Me.Patient_Cash.Requery

'------------------------------------------------------------------------------------------------

ElseIf Me.REQ = 1 Then
Request.SetFocus
DoCmd.GoToRecord , , acNewRec
Request.Form!T_Code = 1
Me.Request.Form!IN_price = Me.Request.Form!IN_Lab
Me.Request.Form!Out_price = Me.Request.Form!Out_lab
Me.Request.Form!TName_R = Me.Request.Form!TName
Me.Request.Form!Date_R = Me.Request.Form!DDate

Me.Request.Form!T_Code.SetFocus
 DoCmd.GoToRecord , , acNewRec
Me.subCash.Requery
Me.Patient_Cash.Requery

'------------------------------------------------------------------------------------------------

ElseIf Me.REQ = 2 Then
Request.SetFocus
DoCmd.GoToRecord , , acNewRec
Request.Form!T_Code = 3
Me.Request.Form!IN_price = Me.Request.Form!IN_Lab
Me.Request.Form!Out_price = Me.Request.Form!Out_lab
Me.Request.Form!TName_R = Me.Request.Form!TName
Me.Request.Form!Date_R = Me.Request.Form!DDate

DoCmd.GoToRecord , , acNewRec

Request.Form!T_Code = 4
Me.Request.Form!IN_price = Me.Request.Form!IN_Lab
Me.Request.Form!Out_price = Me.Request.Form!Out_lab
Me.Request.Form!TName_R = Me.Request.Form!TName
Me.Request.Form!Date_R = Me.Request.Form!DDate

Me.Request.Form!T_Code.SetFocus
Me.Request.Form!T_Code.SetFocus
 DoCmd.GoToRecord , , acNewRec
Me.subCash.Requery
Me.Patient_Cash.Requery

'------------------------------------------------------------------------------------------------

ElseIf Me.REQ = 3 Then
Request.SetFocus
DoCmd.GoToRecord , , acNewRec
Request.Form!T_Code = 3
Me.Request.Form!IN_price = Me.Request.Form!IN_Lab
Me.Request.Form!Out_price = Me.Request.Form!Out_lab
Me.Request.Form!TName_R = Me.Request.Form!TName
Me.Request.Form!Date_R = Me.Request.Form!DDate

Me.Request.Form!T_Code.SetFocus
 DoCmd.GoToRecord , , acNewRec
Me.subCash.Requery
Me.Patient_Cash.Requery

'------------------------------------------------------------------------------------------------

ElseIf Me.REQ = 4 Then
Request.SetFocus
DoCmd.GoToRecord , , acNewRec
Request.Form!T_Code = 4
Me.Request.Form!IN_price = Me.Request.Form!IN_Lab
Me.Request.Form!Out_price = Me.Request.Form!Out_lab
Me.Request.Form!TName_R = Me.Request.Form!TName
Me.Request.Form!Date_R = Me.Request.Form!DDate

Me.Request.Form!T_Code.SetFocus
 DoCmd.GoToRecord , , acNewRec
Me.subCash.Requery
Me.Patient_Cash.Requery

'------------------------------------------------------------------------------------------------

ElseIf Me.REQ = 5 Then
Request.SetFocus
DoCmd.GoToRecord , , acNewRec
Request.Form!T_Code = 5
Me.Request.Form!IN_price = Me.Request.Form!IN_Lab
Me.Request.Form!Out_price = Me.Request.Form!Out_lab
Me.Request.Form!TName_R = Me.Request.Form!TName
Me.Request.Form!Date_R = Me.Request.Form!DDate

Me.Request.Form!T_Code.SetFocus
 DoCmd.GoToRecord , , acNewRec
Me.subCash.Requery

Me.Patient_Cash.Requery

END IF

كيف اوقف اهتزاز عناصر النموذج نموذج CASH ية صورة عند تحديت REQ

تختفى الصورة للحظات وتعطى خلفية بيضاء ثم تعود الصورة مرة اخرى

هل يوجد حل لهذة المشكلة

قام بنشر (معدل)

مجرد فكرة ؛ جرب :power:

اعمل Private Function وسميه بأي اسم تريده مثلاً

Private Function Requ

واجعل الأوامر المتكررة فيه وانهي الـ Function

وبدل ما تكرر الكود كـ 

Me.Request.Form!IN_price = Me.Request.Form!IN_Lab
Me.Request.Form!Out_price = Me.Request.Form!Out_lab
Me.Request.Form!TName_R = Me.Request.Form!TName
Me.Request.Form!Date_R = Me.Request.Form!DDate

 

فقط قم باستدعاء الـ Function , وتكون وفرت واختصرت حجم الكود تقريباً 28 سطر واستبدلتهم بـ 7 فقط .

*لإستدعاء الوظيفة :-  Call Requ

 

هذا مجرد رأي ، وممكن يكون هناك أفضل من رأيي فالخبراء في المنتدى تبارك الرحمن دائماً متواجدون

تم تعديل بواسطه Foksh

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