R
Rob W
Greetings,
I posted in the vb.net forums as I'm developing a vb.net[2008] app with the
backend database being Access 07 (Connection string:
Microsoft.ACE.OLEDB.12.0).
I want a header row in a combobox with a user friendly message e.g. "---
Please choose a member ----"
I suggested I had looked at both vb.net control settings for a combo box and
SQL opportunities to find a solution.
I got a reply to investigate using the UNION ALL in SQL to create a header
row, having played around in Access query design, I cannot resolve my
problem.
The SQL currently used to populate the combobox is below :-
SELECT M.strMembershipId + ' ' + M.strTitle + ' ' + M.strForeNames + ' ' +
M.strSurname as memLookUp, M.*
FROM tblMembers M ORDER BY M.strMembershipId ASC
I select everything from the tblMembers table as it is used to populate a
form based on the value of the strMembershipId primary field.
The code below ties in the selection from the combobox to the primary field
cboSearchKey.ValueMember = "strMembershipId"
I display the alias field Lookup to the user with the following code:-
cboSearchKey.DisplayMember = "memLookUp"
Now to do this with a union I would have to ensure that the number of
columns remain the same for all of select statements, which I find could be
difficult
as I'm selecting everything from the table, many columns.
Also I don't know how to tie in the valuemember of strMembershipId to the
pseudo header row as it won't have a strMembershipId value.
Hope this problem is clear and someone can provide some assistance of how I
can create a header row, which will always appears at the top.
Thanks
Rob
I posted in the vb.net forums as I'm developing a vb.net[2008] app with the
backend database being Access 07 (Connection string:
Microsoft.ACE.OLEDB.12.0).
I want a header row in a combobox with a user friendly message e.g. "---
Please choose a member ----"
I suggested I had looked at both vb.net control settings for a combo box and
SQL opportunities to find a solution.
I got a reply to investigate using the UNION ALL in SQL to create a header
row, having played around in Access query design, I cannot resolve my
problem.
The SQL currently used to populate the combobox is below :-
SELECT M.strMembershipId + ' ' + M.strTitle + ' ' + M.strForeNames + ' ' +
M.strSurname as memLookUp, M.*
FROM tblMembers M ORDER BY M.strMembershipId ASC
I select everything from the tblMembers table as it is used to populate a
form based on the value of the strMembershipId primary field.
The code below ties in the selection from the combobox to the primary field
cboSearchKey.ValueMember = "strMembershipId"
I display the alias field Lookup to the user with the following code:-
cboSearchKey.DisplayMember = "memLookUp"
Now to do this with a union I would have to ensure that the number of
columns remain the same for all of select statements, which I find could be
difficult
as I'm selecting everything from the table, many columns.
Also I don't know how to tie in the valuemember of strMembershipId to the
pseudo header row as it won't have a strMembershipId value.
Hope this problem is clear and someone can provide some assistance of how I
can create a header row, which will always appears at the top.
Thanks
Rob