Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 156
  • Last Modified:

Database Question

Hi, I have a program which access a database (ACCESS).
it does this using two datacontrols and a dbgrid control. the data in the data control is displayed using the following lines in the reposition event of data1.
Data2.RecordSource = "select bookedto, bookeddate, expectedreturn from tblBookingInfo where fgn_DWGINFO = " & Data1.Recordset.Fields("bmk_DWGINFO") & ""
Data2.Refresh

that worked fine, but what I want to do is display a record that corresponds with an item that i click on in a list box.
I put the following line into the click event of the listbox

Data1.RecordSource = "select FILENAME from tblDrawingInfo where filename = '" & List1.Text & "'"
Data1.Refresh

this find the right record but throws up the following error when the data1 controls reposition event fires

"item not found in this collection"
the following seems to be the culprit
Data1.Recordset.Fields("bmk_DWGINFO") & ""
how can i correct this

thanks in advance

MICK
0
Mick_Buckley
Asked:
Mick_Buckley
1 Solution
 
TimCotteeCommented:
YOu are not selecting this field in the select list: FILENAME

Add the appropriate field to the select list:

"select FILENAME,bmk_DWGINFO from tblDrawingInfo where filename = '" & List1.Text & "'"

0
 
Mick_BuckleyAuthor Commented:
Thanks for the great answer, it works fine now

MICK
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now