I'm in the process of making a searchable database for the company I work at, and have run into a few problems. I've googled this stuff and had problems either understanding what I found or finding anything at all..

A. Sorting the table in my form
I'm able to sort in one direction, but I'm lost in how to do it in the opposite direction. I have the simple code

Private Sub labelAudit_Click()
 Me.OrderBy = "Audit"
 Me.OrderByOn = True

Which does what I want, except I need to be able to sort in the opposite direction, and being fairly new to VB haven't figured that out.

B. Global variables
Well, to decide when I'm sorting ascending or when I'm sorting decending I figured I'd keep track of how many times the button has been clicked. If I declare Public sortBox As Integer in my General Declarations, then sortBox = 0 in my form_load() method, and then sortBox=sortBox+1 (or ++ if it works in VB), that should get the job done correct?

C. Usernames/Passwords
I tried messing around with the workgroups stuff, but I got myself into trouble and ended up locking myself out of my own database. I opened it on another computer without problem thankfully, but that also means the Username/Password protection provided would only be on a single computer and not actually encoded within the file. Anyway to set up usernames/passwords within the actual file?

Nevermind, solved my issues. If anyone is curious, the code I used to sort is

If Me.OrderBy = "FieldName" Then
        Me.OrderBy = "FieldName desc"
        Me.OrderBy = "FieldName"
    End If
    Me.OrderByOn = True

And for password/username stuff, I decided to simply have two copies of the file, one kept on the administrator's computer and one on the company's network as read only. When they update it, they have to copy it over to the network and make sure they set it as read only. Problem solved :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.