I have a linked table called [Part Number]
and locally, users need to be able to select a check box (Yes/No) field corresponding to the part number to perform actions on it with other commands. Currently, to have the check box in the displayed query, I have a separate local table that maintains a list of all of the part numbers in [Part Number]
that pairs them with a check box that is then rolled into the displayed query. What I would like to do is have a query that just directly queries [Part Number]
and adds it's own Yes/No field to get rid of the table that has to be constantly updated to make sure all part numbers are accounted for.
I know this is possible for text fields:
SELECT
[Part Number].Concatenate,
[Part Number].[Part Nbr] & " " & Date() AS [Select]
FROM [Part Number];
A field called "Select" will be added to the query with the part number and the date next to it. I want that field to be a Yes/No
field.
Edit:
I don't want the [Part Number]
table to have the Yes/No field on it because it is shared between multiple users and will interfere with actions the database takes based on selections. I also would like to not use a table at all since the parts list changes frequently and the front end table would have to be constantly be getting updated from the back end table [Part Number]
to ensure everything works properly. Having a select query based on the [Part Number]
table would automatically update every time the parts list changes since it's a query, not a table. This query would be rolled into the displayed query that ties together several tables and queries.
As @DonJewett said, this is not possible for Yes/No checkbox fields. Your best bet is to do it the way you are doing; it's easiest to just clear the Yes/No table and repopulate it every time you open the form.
(on Form_Load()
of your selection form, frmMultiSelect
):
Dim strSQL As String
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM tblNodes")
'Clear current links
strSQL = "DELETE * FROM tblMultiSelect"
db.Execute strSQL
'Create '0' state links for every node in tblNodes
rs.MoveFirst
Do Until rs.EOF = True
strSQL = "INSERT INTO tblMultiSelect(node_id, selected) "
strSQL = strSQL & "VALUES (" & rs![node_id] & ", 0);"
db.Execute strSQL
rs.MoveNext
Loop
'Update subform
Me.frmMultiSelect.Requery