Table data show in subforms

Samiullah Malik

New member
Local time
Today, 22:52
Joined
Jan 30, 2023
Messages
10
"Add Patient Test Form" When the data is updated in the group name combo box in the and pick a test name in the table "test list"
Capture2.PNG
Capture.PNG
the test unit and the test normal range are shown in the Add Test subform.
 

Attachments

Make a proper database design first. Something like
1675180095668.png

There no use in designing forms when your database is not ok.

I am not sure about group and what used to be category.
 
Rather than showing the constant fields associated with the combo choice in every row of the subform, just show them in the header. You seem to be asking how to copy the constant fields and you do not need to do that, nor should you do it. The fields are constants and don't change with each row so they stay in the table which provides the RowSource for the combo.

A simple way to show the fields is to include them in the RowSource of the combo. Then in the AfterUpdate event of the combo, you can copy them to unbound textboxes in the form's header where the combo it.

Me.TestName = Me.cboType.Column(2)
Me.Unit = Me.cboType.Column(3)
Me.NormalRange = Me.cbo.Type.Column(4)

Keep in mind that the RowSource is a zero-based array so the bound field is normally the first field. You can refer to that as
Me.cboType --- normal method
or
Me.cboType.Column(0) --- not normal but valid

The second column is then .Column(1), the third is .Column(2), etc.
 
Rather than showing the constant fields associated with the combo choice in every row of the subform, just show them in the header. You seem to be asking how to copy the constant fields and you do not need to do that, nor should you do it. The fields are constants and don't change with each row so they stay in the table which provides the RowSource for the combo.

A simple way to show the fields is to include them in the RowSource of the combo. Then in the AfterUpdate event of the combo, you can copy them to unbound textboxes in the form's header where the combo it.

Me.TestName = Me.cboType.Column(2)
Me.Unit = Me.cboType.Column(3)
Me.NormalRange = Me.cbo.Type.Column(4)

Keep in mind that the RowSource is a zero-based array so the bound field is normally the first field. You can refer to that as
Me.cboType --- normal method
or
Me.cboType.Column(0) --- not normal but valid

The second column is then .Column(1), the third is .Column(2), etc.
its not working .
file attached kindly check the errors in code which i copied from here
 

Attachments

What does "is not working" mean? You didn't even try to implement my suggestion.

We're here to help you not to do it for your. Is there something about my explanation that you do not understand?
 

Users who are viewing this thread

Back
Top Bottom