Minggu, 12 Mei 2013

Re: [MS_AccessPros] Set validation rule

 


John,
Thanks. It is working but it would be nice if the message asks for user input and when user clicks "yes", the focus is set to datecompleted field and if response is "no", the status is reset to previous status. At present, user has to click escape to undo the status change.

Thanks and Regards,
Kumar

--- In MS_Access_Professionals@yahoogroups.com, John Viescas <JohnV@...> wrote:
>
> Kumar-
>
> To make this easier for users, the DateCompleted text box should be in the
> tab order before the Status combo box. I would do this:
>
> Private Sub DateCompleted_AfterUpdate()
> ' If user entered something
> If Len(Me.DateCompleted & "") > 0 Then
> ' Auto-update the status
> Me.cmbStatus = 50
> End If
> End Sub
>
> Private Sub cmbStatus_BeforeUpdate(Cancel As Integer)
> ' Make sure a Date Completed entered first
> If Len(Me.DateCompleted & "") = 0 Then
> ' Tell the user
> MsgBox "You must enter a Date Completed before " & _
> "you can set Status to Completed. Press " & _
> "Esc to clear your edit and enter a " & _
> "Date Completed first."
> ' Cancel the edit
> Cancel = True
> End If
> End Sub
>
> John Viescas, Author
> Microsoft Access 2010 Inside Out
> Microsoft Access 2007 Inside Out
> Microsoft Access 2003 Inside Out
> Building Microsoft Access Applications
> SQL Queries for Mere Mortals
> http://www.viescas.com/
> (Paris, France)
>
>
>
>
> -----Original Message-----
> From: MS_Access_Professionals@yahoogroups.com
> [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of access_kri
> Sent: Sunday, May 12, 2013 12:12 PM
> To: MS_Access_Professionals@yahoogroups.com
> Subject: [MS_AccessPros] Set validation rule
>
> Dear All,
> I have statuscode field which has statuses 10,20,30,40 and 50.
> StatusCode 50 indicates the activity is completed. There is also another
> field DateCompleted. I desire that when users update the statuscode to 50
> (completed), they must first enter the dateCompleted field. In other words,
> when the dateCompleted field is blank and users updates the statuscode to 50
> (complete), the user should get a validation text or messagebox that "You
> must first update the DateCompleted" and new status should be cancelled and
> focus should shift to DateCompleted field. For other statuscodes, it should
> not give any message.
>
> I tried using beforeUpdate event of Statuscode to achieve this but
> was not successful. Require some assistance.
>
> Kind Regards,
> Kumar
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar