Linking to a single Cell in Excel

  • Thread starter Thread starter Guest
  • Start date Start date
Not directly. You'd have to do it via automation to read and write the value
into that textbox, or link the spreadsheet and then use a DLookup function
to find the appropriate "cell" (actually a record for a specific field) and
put that value in the textbox.
 
(evil cackle)

paste something like this into the control source of a text box:

=[application].[Currentdb].[OpenRecordset]('select * from [Excel
5.0;HDR=no;DATABASE=C:\Program Files\CAPIX\fred.xls].[a4:a4]').[Fields](0)

(end evil cackle)

Unfortunately, that will give you a read-only value. If you want to write
to the cell, you will have to either use a linked table (which you can join
to the record source of the form), or OLE automation. With a little
practice, you will find that you can link a cell from a spreadsheet onto a
form in design view: either as a OLE bound form control, or as an OLE
unbound frame control (actually, you can copy and paste, but that gives you
an embedded spreadsheet, not a link)

By the way, that sample code posted above using Application.Currentdb is
from A2K. It might not work with A2K3. And it doesn't work with CodeDb: I
leave that explanation as an exercise for the reader.
(david)
 
david epsom dot com dot au said:
(evil cackle)

paste something like this into the control source of a text box:

=[application].[Currentdb].[OpenRecordset]('select * from [Excel
5.0;HDR=no;DATABASE=C:\Program Files\CAPIX\fred.xls].[a4:a4]').[Fields](0)

(end evil cackle)


< people run screaming from the room >
 
Back
Top