Access¿ìËÙ¿ª·¢»ù´¡½Ì³Ì
ÍøÕ¾¹«¸æ
¡¤Accessר¼Ò¿ÎÌÃQQȺºÅ£º239158550    ¡¤Access¿ìËÙ¿ª·¢Æ½Ì¨ÏÂÔØµØÖ·¼°½Ì³Ì    ¡¤»¶Ó­¼ÓÈëAccessר¼Ò¿ÎÌÃ΢ÐÅȺ£¡    ¡¤ÈçºÎ¿ìËÙËÑË÷±¾Õ¾ÎÄÕÂ|ʾÀý|×ÊÁÏ    
ÄúµÄλÖ㺡¡Ê×Ò³ > ¼¼ÊõÎÄÕ > ×ÛºÏÆäËü

¡¾ÒëÎÄ¡¿µ±Ç°ÖµÓëǰһÌõ¼Ç¼µÄÖµµÄ±È½Ï£¨Ïàͬ×ֶΣ©

ʱ¡¡¼ä:2012-04-13 07:43:45
×÷¡¡Õß:ÖÜ·¼   ID£º24526  ³ÇÊУºÉϺ£
Õª¡¡Òª:ÔÚ¸üкóʼþ£¬±È½Ï×ֶεÄÔ­ÖµºÍ×ֶεÄÐÂÖµ¡£
Õý¡¡ÎÄ:

Ô­×÷ÕߣºÎ´Öª¡¡¡¡·­Ò룺ÖÜ·¼

¡¾ÒëÎÄ¡¿ÔÚ¸üкóʼþ£¬±È½Ï×ֶεÄÔ­ÖµºÍ×ֶεÄÐÂÖµ¡£

        ÏëÖªµÀΪʲôºÜÄÑÔÚÓû§¸üÐÂ×ֶκóÕÒ³ö×ֶεÄÔ­ÖµÂð?ÎÒÈÏΪ¸üÐÂǰʼþ¿ÉÒÔͨ¹ýMe.[×Ö¶ÎÃû]»ñµÃÔ­Öµ¡£

        ÕâÀïÓÐÒ»¸ö¼òµ¥µÄ·½·¨À´×öµ½ÕâÒ»µã£ºÊ×ÏÈÔÚ´°ÌåÄ£¿éÖС°Option Compare Database¡±µÄ´úÂëºóÃæ¶¨ÒåÒ»¸öÈ«¾Ö±äÁ¿¡£Õâ¸öÀý×ÓÀï,ÎÒÃǶ¨ÒåÒ»¸östringÀàÐ͵ıäÁ¿:hold_value.

Option Compare Database
   Dim hold_value As String
    ...

        ½ÓÏÂÀ´ÎÒÃÇÔÚ´°ÌåÖн¨Á¢Ò»¸ö¡°³ÉΪµ±Ç°¡±Ê¼þ£º

Private Sub Form_Current()
    hold_value = Me.icount       ¡¯icountÊÇ×Ö¶ÎÃû
End Sub

        Äã¿ÉÄܻᷢÏÖÄã»áµÃµ½Ò»¸ö¿ÕÖµµÄ±¨´í,ËùÒÔÄã¿ÉÄÜÏëҪʹÓÃÏÂÃæµÄ·½·¨À´ÈÆ¿ªÕâ¸öСÎÊÌâ:

hold_value = Nz(Me.icount, "") ¡¯°Ñ¿Õֵת»»³É¿Õ×Ö·û´®

        ×îºóÔÚ¸üÐÂʼþºó£¬Ô­ÖµºÍÐÂÖµ¶¼¿É¹©ÎÒÃÇʹÓá£

¡¾Ô­ÎÄ¡¿

Compare original value of field to new value of field in the after update event.


Ever wonder why it is so difficult to figure out what the original value of a form field was after the user updates the field? I thought that the Before Update event would help me do this but using the Me.Fieldname.Oldvalue doesn't give me the old value it gives the new value!

Here is a simple way to do this:  First set up a global variable in this form just after the Option Compare Database.  In this example we dimension a string variable called hold_value.

Option Compare Database
   Dim hold_value As String
    ...

Next we create an On Current event for the form:

Private Sub Form_Current()
    hold_value = Me.icount      

End Sub

You may find that you get a null value error so you might want to use the following assignment to get around this little problem:

hold_value = Nz(Me.icount, "")


Finally in the After Update event we have both the new and old values available for us to use.



AccessÈí¼þÍøQQ½»Á÷Ⱥ (ȺºÅ:115180141) ¡¡¡¡¡¡¡¡¡¡¡¡AccessÔ´ÂëÍøµê

³£¼ûÎÊ´ð:

¼¼Êõ·ÖÀà:

Ïà¹Ø×ÊÔ´:

רÀ¸×÷¼Ò

¹ØÓÚÎÒÃÇ | ·þÎñÌõ¿î | ÔÚÏßͶ¸å | ÓÑÇéÁ´½Ó | ÍøÕ¾Í³¼Æ | ÍøÕ¾°ïÖú