Help in query

  • Thread starter Thread starter Eric
  • Start date Start date
E

Eric

I need the 11,13 equipment1 in table tbl_Events from table
tbl_EquipmentChronology

Table:tbl_EquipmentChronology
TicketNum Outlet Equipment1
1486 1 SABGJMLRS
1486 2 SABGJPFZH
1486 3 SABGJPGDB
1486 4 SABJCKCMZ
1486 5 SABGJPGBV
1486 6 SABJHJZLJ
1486 7 SABJRZZHR
1486 8 SABHFMXQM
1486 9 SABHCBNWC
1486 11 SABHFVLPP
1486 13 SABGVPCTV

Table: tbl_Events
TicketNum PPVVOD_Outlet Equipment1
1486 11
1486 13
 
You need to tell us what criteria you are using to choose the last two
records. Is that it? Do you need the last two records? Or do you need the
records specifically numbered 11 and 13?
 
Thanks for your reply. I create a query and it works fine. I check it
in debugger it gives me the correct value. But the textbox which i
create in the form is not bound with the table. I dont know it needs to
bound or not as i need only a textbox for display. In this text box it
shows the last value of the recordset and repeat it in the subform. I
dont know how to i fix this problem.

Dim qry As String, rst As Object
qry = "SELECT tbl_EquipmentChronology.Equipment1 FROM
tbl_EquipmentChronology INNER JOIN tbl_events ON
tbl_events.TicketNum=tbl_EquipmentChronology.TicketNum where
tbl_events.TicketNum=" &
Forms!tbl_PPVResearch_Edit!frm_Events!TicketNum & " and
tbl_events.PPVVOD_Outlet=tbl_EquipmentChronology.Outlet"
Set rst = CurrentDb.OpenRecordset(qry)
rst.MoveFirst
Do While Not rst.EOF
Forms!tbl_PPVResearch_Edit!frm_Events!text2 = rst!Equipment1
rst.MoveNext
Loop
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top