Changing subdatasheet with code

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
 
R

Rene

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é
 
T

Tim Ferguson

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
 

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

Top