I have a form (MAC_addr_frm) with a combo box (DVcode)
which is populated by the table Device_Code_tbl.ID
I am trying to populate the following 3 text boxes on this form
from what device code is selected by the DVcode combo box:
1). pNum - to be populated from Device_Code_tbl.Asm_Num
2). Descr - to be populated from Device_Code_tbl.Descr
3). Laddr - to be populated from MAC_Addr_tbl.Lastaddr
So I created the following query (Mac_addr_qry):
SELECT Device_Code_tbl.Asm_Num, MAC_Addr_tbl.Lastaddr, Device_Code_tbl.Descr
FROM Device_Code_tbl INNER JOIN MAC_Addr_tbl ON Device_Code_tbl.ID = MAC_Addr_tbl.ID
WHERE (((Device_Code_tbl.ID)=[forms]![MAC_addr_frm]![DVcode]));
Then in an attempt to populate the 3 text boxes, I set the control source
for these to the following:
pnum =[Mac_Addr_qry]![Asm_Num]
Descr =[Mac_Addr_qry]![Descr]
Laddr =[Mac_Addr_qry]![Lastaddr]
In the OnChange event for the combo box DVcode, I put the following code:
Private Sub DVcode_Change()
DoCmd.OpenQuery "Mac_Addr_qry", acViewNormal, acReadOnly
Repaint
End Sub
So when I change the value in the DVcode combo box, the 3 text boxes
do not get updated and the Mac_Addr_qry results pop up...
What am I doing wrong and how can I correct this so that the text boxes
get updated and the query results does not pop up...
thanks
which is populated by the table Device_Code_tbl.ID
I am trying to populate the following 3 text boxes on this form
from what device code is selected by the DVcode combo box:
1). pNum - to be populated from Device_Code_tbl.Asm_Num
2). Descr - to be populated from Device_Code_tbl.Descr
3). Laddr - to be populated from MAC_Addr_tbl.Lastaddr
So I created the following query (Mac_addr_qry):
SELECT Device_Code_tbl.Asm_Num, MAC_Addr_tbl.Lastaddr, Device_Code_tbl.Descr
FROM Device_Code_tbl INNER JOIN MAC_Addr_tbl ON Device_Code_tbl.ID = MAC_Addr_tbl.ID
WHERE (((Device_Code_tbl.ID)=[forms]![MAC_addr_frm]![DVcode]));
Then in an attempt to populate the 3 text boxes, I set the control source
for these to the following:
pnum =[Mac_Addr_qry]![Asm_Num]
Descr =[Mac_Addr_qry]![Descr]
Laddr =[Mac_Addr_qry]![Lastaddr]
In the OnChange event for the combo box DVcode, I put the following code:
Private Sub DVcode_Change()
DoCmd.OpenQuery "Mac_Addr_qry", acViewNormal, acReadOnly
Repaint
End Sub
So when I change the value in the DVcode combo box, the 3 text boxes
do not get updated and the Mac_Addr_qry results pop up...
What am I doing wrong and how can I correct this so that the text boxes
get updated and the query results does not pop up...
thanks