Changing subdatasheet with code

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

Hello, using a button click event I need to open the
main table of my database but now showing a different
related table as a subdatasheet. I suppose I have to
change with code the subdatasheetname property to obtain
that result, but I have no idea how to do it. Could
somebody help me with the code for that? many thanks in
advance

Paul
 
Hi Paul,

I'm learning as I go along too!

Try this:

set db = currentdb()
set tdf = db.TableDefs("MyTableName")
tdf.properties("subdatasheetname")="Table.WhatIWant"

This needs to be done before the code which opens the table, I think

René
 
Hello, using a button click event I need to open the
main table of my database but now showing a different
related table as a subdatasheet.

NONONononononoooo - just create a form that does what you want. Use table
datasheets only for design and debugging, because they just don't have
enough control to allow decent data interaction for users.

Base the form on a query and you can choose exactly which fields from which
tables you like.

HTH


Tim F
 
Back
Top