Kamis, 26 Mei 2011

[MS_AccessPros] On Dirty

 

Ok,...I now have a combo box I can select an entry to edit. I also added a command button to select a new record if it is an addition.

To prevent accidentally changing data I think I need to add code so that if the cmdNewMember button is clicked, a message box will pop up asking to save the current changes.

Is the On Dirty event that right place to put this code?

It is my understanding (please correct if I am wrong) that Dirty will be true if anything on the form has been changed (not by code). So If Dirty is false, then going to a new record is ok,...If Dirty is true, then we either have to save the changes or cancel.

Thanks for all the help,

Stevn

--- In MS_Access_Professionals@yahoogroups.com, "John Viescas" <john@...> wrote:
>
> Steven-
>
> You need a separate *unbound* combo box named cmbMemberLookup. (Unbound means
> the control has no Control Source.) Use the same Row Source that you had for
> MemberID, and add this code:
>
> Private Sub cmbMemberLookup_AfterUpdate()
>
> Me.Recordset.FindFirst "MemberID = " & Me.cmbMemberLookup
>
> End Sub
>
> Private Sub Form_Current()
>
> ' Keep the search combo in sync with the current record
> Me.cmbMemberLookup = Me.MemberID
>
> End Sub
>
>
> John Viescas, author
> Microsoft Office Access 2010 Inside Out
> Microsoft Office Access 2007 Inside Out
> Building Microsoft Access Applications
> Microsoft Office Access 2003 Inside Out
> 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 S and M
> Sent: Wednesday, May 25, 2011 11:53 PM
> To: MS_Access_Professionals@yahoogroups.com
> Subject: [MS_AccessPros] Selecting a record set with a combo box
>
> Hi all,
>
> I created a form with a sub form to edit / enter data into two tables.
> Everything works great and I can edit / add records and they save fine.
>
> My problem will be when the tables get several hundred entries. I need to be
> able to select the entry I want to edit from a drop down box.
>
> The two forms are linked by MemberID,..the main forms record source is
>
> the main table and the subform is a select statement of other table.
>
> If I change the memberID field to a combo box, and add a select statement, it
> will list the ID's but will not allow me to select one.
>
> What am I not doing?
>
> Thanks, Steven
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar