I have on problem and one curiosity.
The first problem I have is that I have 2 listboxes, sort of like cascading listboxes. You select a record in the first listbox and the second listbox is generated from the criteria in the first listbox. The problem I have is that when you add a new incident #(from clicking on the button below) the incident gets added properly but if you select the incident and inmate that was just added, the text boxes get populated from the first record in the table not from the recordset...the text boxes should be blank until you add the data.....
The curiosity is that I saw in some code somewhere a neat way to populate unbound controls in a form. On this form, if the controls are bound, when the form opens, the controls are populated with the first record when I want them to be blank. (see frmEdit). The code I saw was something like this...
for x=1 to Controls.count
if control.type=label then next (this is to skip labels or other controls you want to skip)
control(x).text = ""
next
You could also use this to store the data in to a record
for x=1 to Controls.count
if control.type=label then next (this is to skip labels or other controls you want to skip)
rs.fields(x)=control(x).text
next
I know I am probably way off in the syntax but at least it gives you a clue of what I would like to do...would cut down on a lot of code.
But then again, if I can get the text boxes to be blank when the form opens, I wouldn't have to go through all this
Thanks!
The first problem I have is that I have 2 listboxes, sort of like cascading listboxes. You select a record in the first listbox and the second listbox is generated from the criteria in the first listbox. The problem I have is that when you add a new incident #(from clicking on the button below) the incident gets added properly but if you select the incident and inmate that was just added, the text boxes get populated from the first record in the table not from the recordset...the text boxes should be blank until you add the data.....
The curiosity is that I saw in some code somewhere a neat way to populate unbound controls in a form. On this form, if the controls are bound, when the form opens, the controls are populated with the first record when I want them to be blank. (see frmEdit). The code I saw was something like this...
for x=1 to Controls.count
if control.type=label then next (this is to skip labels or other controls you want to skip)
control(x).text = ""
next
You could also use this to store the data in to a record
for x=1 to Controls.count
if control.type=label then next (this is to skip labels or other controls you want to skip)
rs.fields(x)=control(x).text
next
I know I am probably way off in the syntax but at least it gives you a clue of what I would like to do...would cut down on a lot of code.
But then again, if I can get the text boxes to be blank when the form opens, I wouldn't have to go through all this
Thanks!
Attachments
Last edited: