This is a new question, perhaps addressing it in a new thread?
That said, it's a bit complex, and I wont be able to do anything more than some sketching.
In most of the db's I design, I keep a table containing only one record, with a lot of settings. This might be for instance company name, different preferences and settings, timestamps for different events interesting at application level (last backup/archive.). You'll need to decide at what level you need to keep your info, whether it is application level or perhaps per patient (if the latter, you could probably add it to the recordsource of the form and update thru assigning to a bound texctontrol)
Or, the way I usually do it, is dumping the new info to the table. For instance like this:
[tt]dim sSql as string
sSql = "Insert into tblMisc (BlahDate) Values (#" & format$(Now(),"yyyy-mm-dd") & "#)"
docmd.runsql sSql[/tt]
And open a recordset to retrieve it again.
[tt]dim sSql as string
dim rs as DAO.recordset
sSql = "Select BlahDate from tblMisc"
set rs = currentdb.openrecordset(sSql)
if not rs.bof and not rs.eof then
Me!txtSomeBox.Value = rs("BlahDate").Value
end if
rs.close
set rs = nothing[/tt]
If using the Main/parent patient record, the appropriate where condition would probably need to be applied.
If you have buttons in the detail section of a continuous form ("to the right of each record"), they are all considered one button. So hide one, based on some criteria, you'll "hide all". (Conditional formatting gives the possibility of enabling and disabling control based on value, but not buttons)
Adding the same values to all these records "wholesale", I'm not sure I agree. I wouldn't add this info to each record unless I needed to track something per each record. In this scenario, it seems storing the info per patient seems more appropriate.
Still - little sample on looping thru the recordset of a form, assigning a value to one field:
[tt]dim rs as dao.recordset
set rs = me.recordsetclone
if not rs.eof then
rs.movefirst
do while not rs.eof
rs.edit
rs("FieldName").Value = Me!txtSomeBox.Value
rs.update
rs.movenext
loop
end if
set rs = nothing[/tt]
- as always, typed not tested;-)
And, again, if this doesn't give the answers you need, consider posting in a new thread.
Roy-Vidar