Connecting Tech Pros Worldwide Help | Site Map

Lookup

Eric
Guest
 
Posts: n/a
#1: Aug 14 '06
I try to get the value in subform 2. So i go to the table of subform 2
name tbl_Events and create a field name equip and in the lookup i wrote
this query but it still not showing any thing in the field:

SELECT tbl_EquipmentChronology.Equipment1 FROM tbl_EquipmentChronology
WHERE
tbl_events.PPVVOD_Outlet=tbl_EquipmentChronology.O utlet;

There are two sub forms in main form. One has value which are comming
from Table: tbl_EquipmentChronology

Outlet Equipment
2 ABCBCBD
3 DKJDKJD
4 KDJKDJK

Second has also a variable name outlet of table tblEvents. I need help
how to i display the equipment next to the outlet in

2nd subform from first subform. I dont want to save this into table
just need a display in the second subform.

Thanks,

Jeff L
Guest
 
Posts: n/a
#2: Aug 14 '06

re: Lookup


Your query for Sub2 is a little off. You are trying to refer to a
value on Subform 1 from Subform2 correct?

Your query would be this
SELECT tbl_EquipmentChronology.Equipment1
FROM tbl_EquipmentChronology
WHERE
tbl_EquipmentChronology.Outlet = Forms!MainFormName!SubForm1Name!Outlet

Hope that helps!



Eric wrote:
Quote:
I try to get the value in subform 2. So i go to the table of subform 2
name tbl_Events and create a field name equip and in the lookup i wrote
this query but it still not showing any thing in the field:
>
SELECT tbl_EquipmentChronology.Equipment1 FROM tbl_EquipmentChronology
WHERE
tbl_events.PPVVOD_Outlet=tbl_EquipmentChronology.O utlet;
>
There are two sub forms in main form. One has value which are comming
from Table: tbl_EquipmentChronology
>
Outlet Equipment
2 ABCBCBD
3 DKJDKJD
4 KDJKDJK
>
Second has also a variable name outlet of table tblEvents. I need help
how to i display the equipment next to the outlet in
>
2nd subform from first subform. I dont want to save this into table
just need a display in the second subform.
>
Thanks,
Eric
Guest
 
Posts: n/a
#3: Aug 14 '06

re: Lookup


It gives an error:

Private Sub Text8_BeforeUpdate(Cancel As Integer)
SELECT tbl_EquipmentChronology.Equipment1 FROM tbl_EquipmentChronology
WHERE tbl_EquipmentChronology.Outlet =
Forms!tbl_PPVResearch_New!tbl_PPVResearch_New!Outl et
End Sub

Compiler Error:
Expected: Case
-----------------------------------------------------------------------------------

Jeff L wrote:
Quote:
Your query for Sub2 is a little off. You are trying to refer to a
value on Subform 1 from Subform2 correct?
>
Your query would be this
SELECT tbl_EquipmentChronology.Equipment1
FROM tbl_EquipmentChronology
WHERE
tbl_EquipmentChronology.Outlet = Forms!MainFormName!SubForm1Name!Outlet
>
Hope that helps!
>
>
>
Eric wrote:
Quote:
I try to get the value in subform 2. So i go to the table of subform 2
name tbl_Events and create a field name equip and in the lookup i wrote
this query but it still not showing any thing in the field:

SELECT tbl_EquipmentChronology.Equipment1 FROM tbl_EquipmentChronology
WHERE
tbl_events.PPVVOD_Outlet=tbl_EquipmentChronology.O utlet;

There are two sub forms in main form. One has value which are comming
from Table: tbl_EquipmentChronology

Outlet Equipment
2 ABCBCBD
3 DKJDKJD
4 KDJKDJK

Second has also a variable name outlet of table tblEvents. I need help
how to i display the equipment next to the outlet in

2nd subform from first subform. I dont want to save this into table
just need a display in the second subform.

Thanks,
Jeff L
Guest
 
Posts: n/a
#4: Aug 14 '06

re: Lookup


Ah-ha! You didn't mention your query was in a piece of code.

Dim qry as string, rst as object

qry = "SELECT tbl_EquipmentChronology.Equipment1 FROM
tbl_EquipmentChronology
WHERE tbl_EquipmentChronology.Outlet = '" &
Forms!tbl_PPVResearch_New!tbl_PPVResearch_New!Outl et & "';"

set rst = Currentdb.openrecordset(qry)

If rst.eof = False then
rst.movefirst
End If

Forms!MainFormName!SubForm2!Equipment = rst!Equipment1

Is that what you wanted?
Hope that helps!



Eric wrote:
Quote:
It gives an error:
>
Private Sub Text8_BeforeUpdate(Cancel As Integer)
SELECT tbl_EquipmentChronology.Equipment1 FROM tbl_EquipmentChronology
WHERE tbl_EquipmentChronology.Outlet =
Forms!tbl_PPVResearch_New!tbl_PPVResearch_New!Outl et
End Sub
>
Compiler Error:
Expected: Case
-----------------------------------------------------------------------------------
>
Jeff L wrote:
Quote:
Your query for Sub2 is a little off. You are trying to refer to a
value on Subform 1 from Subform2 correct?

Your query would be this
SELECT tbl_EquipmentChronology.Equipment1
FROM tbl_EquipmentChronology
WHERE
tbl_EquipmentChronology.Outlet = Forms!MainFormName!SubForm1Name!Outlet

Hope that helps!



Eric wrote:
Quote:
I try to get the value in subform 2. So i go to the table of subform 2
name tbl_Events and create a field name equip and in the lookup i wrote
this query but it still not showing any thing in the field:
>
SELECT tbl_EquipmentChronology.Equipment1 FROM tbl_EquipmentChronology
WHERE
tbl_events.PPVVOD_Outlet=tbl_EquipmentChronology.O utlet;
>
There are two sub forms in main form. One has value which are comming
from Table: tbl_EquipmentChronology
>
Outlet Equipment
2 ABCBCBD
3 DKJDKJD
4 KDJKDJK
>
Second has also a variable name outlet of table tblEvents. I need help
how to i display the equipment next to the outlet in
>
2nd subform from first subform. I dont want to save this into table
just need a display in the second subform.
>
Thanks,
Closed Thread


Similar Microsoft Access / VBA bytes