gc**********@hotmail.com (Megan) wrote in message news:<62**************************@posting.google. com>...
Yes, I'm definately going to need more explanation on doing these.
Maybe a step-by-step explanation would be good. Honestly, I don't know
anything about Access, other than entering information into an already
created database. I appreciate your help and it sounds like you have
the answers to my problems. Thanks.
Megan :)
To start the textboxes and comboboxes as locked, highlight all the
textboxes and comboboxes only and then use the View menu to look at
the Properties. You should get a 'Multiple selection' properties box.
Click the 'All' tab and look for the 'Locked' property. Set this to
'True.' Use the Toolbox Icon to create a new command button but hit
cancel when the wizard comes up. Change the name to 'cmdLock' and the
Caption to 'Lock.' Click the 'Event' tab. Click to the right of
'OnClick' then click on the three dots to the far right. When the
'Choose Builder' window comes up select 'Code Builder', then click OK
(or just double click on Code Builder). Paste the lock code right
where the cursor is. Close the code and properties windows and do the
same for unlock, remembering to change the "True" in the code to
"False." Now create a toggle button. Call its name tglID. For its
Caption put in 'Sort By ID.' To the right of the Default property put
-1. For its OnClick code put in:
If tglID.Value = 0 Then Exit Sub
tglType.Value = 0
tglCompanyName.Value = 0
Me.RecordSource = "SELECT * FROM tblContacts ORDER BY ID;"
Me.Requery
Make sure the Form Property 'Record Source' starts with the one above.
Create another toggle button called tglType with Caption 'Sort By
Type.' To the right of the Default property put 0. In its OnClick
code put:
If tglType.Value = 0 Then Exit Sub
tglID.Value = 0
tglCompanyName.Value = 0
Me.RecordSource = "SELECT * FROM tblContacts ORDER BY Type;"
Me.Requery
And finally, cmdCompanyName w/ 'Sort By Co. Name' Caption and Default
= 0:
If tglCompanyName.Value = 0 Then Exit Sub
tglID.Value = 0
tglType.Value = 0
Me.RecordSource = "SELECT * FROM tblContacts ORDER BY CompanyName;"
Me.Requery
Your three toggle buttons will change the form sort order. Note that
the form will display the first record of the sort when you change the
sort.
James A. Fortune