Select Distinct VERSION FROM MyTable
You will get:
A
B
C
Now, loop thru the outcome from above and build this SQL:
SELECT TOP (1) * FROM MyTable Where VERSION = 'A'
UNION ALL
SELECT TOP (1) * FROM MyTable Where VERSION = 'B'
UNION ALL
SELECT TOP (1) * FROM MyTable Where VERSION = 'C'
Run...
Something like:
.Body = "Good Day," & vbNewLine & vbNewLine & _
"Please let this Email serve as a verbal warning"
BTW, there is a separate forum for VBA Visual Basic for Applications (Microsoft)
If the User does not have any Role assigned, there is nothing to display in (role's) Name column for that User
(unless you want to display: 'Role not assigned' or something like that)
And I see kind of poor data in your st_role table:
800 Super Administrator
...
811 Super Administrator
...
916...
It looks like you have 941 Users with no Role(s) assigned to them. And that's why their st_role.sf_name is NULL
Their IDs are not in st_useraccount_roles table :(
I cannot see your data in your tables, so it is difficult to know what's going on.
It is possible you have Users without any Role(s)?
To check, run this statement:
Select sf_user_id
From sf_user
Where sf_user_id NOT IN
(Select sf_user_id
From st_useraccount_roles)
Add to the end of your Select:
Select ...,
R.sf_name, R.df_role_id
From...
and see if you get id's for these NULLS.
Is it possible you have some Roles without their names in st_role table?
With your setup, I would assume every User belongs to just one Department, and can have at least one role, but user can be assigned more than one role, hence the st_useraccount_roles table.
If that's true, I would try:
SELECT
U.sf_firstname as "First Name", U.sf_lastname as "Last Name"...
You don't "put this code in command button".
In the cmd you just need:
Unload Me
and the rest (setting form to nothing) is done in
Private Sub Form_QueryUnload
In VB6, all *.frm (form) files are just text files and you can open them in Notepad, for example.
You are going to see something like below which you can change, save, an re-open in VB6 IDE
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
...
StartUpPosition = 3 'Windows...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.