Let me explain....
The database does have an interface - it has a form + code that
generates a list of manuals from table "A" in the database, then pulls
text from table "B" based on the manual selected from table "A" and
then uses Word automation to output the text from table "B" as a Word
document. One of the things this form code does while processing
records from table "B" and creating the Word doc is to concatenate text
from two fields from table "B" records so that it looks like a single
paragraph in the Word doc.
So, before I invoke the form and create the Word docs, I have to do
data entry into table "B". However, I do not use a form do to data
entry into the table "B". I use the Access data sheet view to do the
data entry into table "B". What I want is a preview of the two fields
concatenated together (i.e., before I actually produce the Word doc).
I want to invoke a macro which invokes a function which will
concatenate the two text fields and show them to me as the preview.
What I can't figure out is how to pass the key of the record the cursor
was on when I invoked the macro TO the macro, and then on to the
function (using the Runcode action) so I can read the record,
concatenate the text, and display it in a msgbox or something.
I have successfuly invoked a macro while in datasheeet view
(Tools->macro->run) - I just can't figure out how to pass the key of
the record the cursor was on when I invoked the macro TO the macro, and
then on to the function invoked by the macro (using the Runcode
action). Right now, the functin just throws up an empty msgbox
I guess I could create a form to show table "B" in datasheet view just
so I have a form, but that seems unnecessary if I can figure out how to
pass the recodrd key to the macro and function
Does this make sense?
pi********@hotmail.com wrote:
Bill wrote:
This database has no forms. I am viewing an Access table in datasheet
view. I'd like to execute a macro to execute a function (using
"runcode"). In the function, I'll reading data from the record the
cursor was on in the datasheet at the time I executed the macro.
So, the questions are: 1) In the macro, how to I get my hands on the
record key or record data of the record the cursor was on in the
datasheet at the time I executed the macro, and 2) How do I pass the
record key or record data of the record the cursor was on in the
datasheet at the time I executed the macro to the function invoked from
the macro?
Thanks
Hmm...
You're not using forms but you're using macros. Create a form, drop
the primary key of the table on it, then reference the primary key on
the form in your query. Then put a button on your form to run the
query for you. Just wondering... why do you have an interfaceless
database?