473,396 Members | 1,898 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Manipulate current datasheet record in function invoked from macro

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

Oct 10 '06 #1
5 3467

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?

Oct 10 '06 #2
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?
Oct 10 '06 #3
I kind of lied. The database does have an interface (form+code), but I
don't use it for data entry. Also, you can develop and use macros
without having created the first form, yes?

Anyway, the DB 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.

Before I invoke the form to create the Word docs, I have to do data
entry in 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 figure I can accomplish this by setting my cursor on a record (in
datasheet view), invoking a macro which uses runcode to invoke a
function. The function will pull a query to grab the record that my
cursor was on (when I invoked the macro), concatenate the two fields
and show them to me in a message box. What I can't figure out is how to
pass the key of the record the cursor. The only gotcha is that I need
to pass the key of the record that the cursor was on when the macro was
invoked TO the macro, and then on to the 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?
Oct 11 '06 #4
I kind of lied. The database does have an interface (form+code), but I
don't use it for data entry. Also, you can develop and use macros
without having created the first form, yes?

Anyway, the DB 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.

Before I invoke the form to create the Word docs, I have to do data
entry in 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 figure I can accomplish this by setting my cursor on a record (in
datasheet view), invoking a macro that uses runcode to invoke a
function. The function will pull a query to grab the record that my
cursor was on (when I invoked the macro), concatenate the two fields
and show them to me in a message box. What I can't figure out is how to
pass the key of the record the cursor was on when I invoked the macro.
The only gotcha is that I need to pass the key of the record that the
cursor was on when the macro was invoked TO the macro, and then on to
the 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?
Oct 11 '06 #5
I would create a form that views a single record at a time, point the
query at the form to get the criteria and then pass the filtered query
to Word. But that's just me...

Oct 11 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Charles Robinson III | last post by:
Hi Everyone, I have been working on various things within this same database for the past 5-months, and has given me nothing but trouble in the development, because the people I am designing...
2
by: Tony | last post by:
Hello, I am having difficulty in getting the current record of the current form to show after pressing a command button that takes me to another form. The command button takes me to another...
5
by: Danny | last post by:
I am using a switchboard to load a form that I would like to display in datasheet view or table view. But it does not go into that mode when using the switchboard wizard to launche the form. is...
1
by: xmp333 | last post by:
Hi, I have a form that is designed as a data sheet view. Attached to this is a subform with some VB code. When the user clicks on a row, the subform should pop up and run the VB code which...
3
by: tsteinke | last post by:
What is the syntax to refer to your current row in an SQL statement? I am using the "Lookup Wizard" to build a query in a table. How do you refer to the Current Row For instance I have a Table...
1
by: 4004 | last post by:
I would like to open a columnar form (so I can see all the details) from a datasheet form (so I can see what is there) but keep the same recordset and current record. I can do the recordset set...
2
by: zandiT | last post by:
hello i have an access database which ive just put on a shared folder on the network for users to use. i tested it well, exported all the objects in a new database, converted to to an mde file,...
1
by: OzNet | last post by:
Hi I am using Access 2007 I have a form called frmProjects and a tabbed panel on it. The first tab is Project Details, the Second is Lump Sum Estimate and the third is Percentage Estimate ...
1
by: menkenk | last post by:
Good Afternoon, I currently have an issue in trying to get a macro working for clicking a record in a subform datasheet to open a form with the complete record details of that specific record....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.