How send pick data from a report to a form using VBA in Access 2007 (1 Viewer)

Punice

Registered User.
Local time
Yesterday, 20:40
Joined
May 10, 2010
Messages
135
Is it possible to incorporate VBA in a report to send record's picked field's data that is displayed to a form.
If so, please show me an example(s)
 

jdraw

Super Moderator
Staff member
Local time
Yesterday, 20:40
Joined
Jan 23, 2006
Messages
15,394
I think you should be using a form, select a control/record and process as you need.
 

GPGeorge

George Hepworth
Local time
Yesterday, 17:40
Joined
Nov 25, 2004
Messages
1,992
Is it possible to incorporate VBA in a report to send record's picked field's data that is displayed to a form.
If so, please show me an example(s)
This is actually the reverse workflow from the way forms and reports are designed to work.

Forms are the dynamic objects through which users interact with data. Report are essentially used to display data.

Therefore, it would be helpful to know why you want to go against design to accomplish this. Perhaps it's possible to accomplish your real goal in a more direct manner.
 

Eugene-LS

Registered User.
Local time
Today, 03:40
Joined
Dec 7, 2018
Messages
481
Is it possible to incorporate VBA in a report to send record's picked field's data that is displayed to a form.
See example below
01. Open report
02. Click on any record of the report - form of this record will open ...
 

Attachments

  • Send pick data from a report to a form using VBA in Access 2007_V001.zip
    161.3 KB · Views: 187

Punice

Registered User.
Local time
Yesterday, 20:40
Joined
May 10, 2010
Messages
135
This is actually the reverse workflow from the way forms and reports are designed to work.

Forms are the dynamic objects through which users interact with data. Report are essentially used to display data.

Therefore, it would be helpful to know why you want to go against design to accomplish this. Perhaps it's possible to accomplish your real goal in a more direct manner.
I understand what you wrote. Here is what I was hoping to achieve, if what I asked was possible.

I'm a trucking company person entering data in a new form that will include all of the information pertaining to a load, such as: the name of the broker I will use, eventually, pickup location, pickup date, destination location and the material that will be hauled.

In the past, I have used numerous brokers to haul the same load and, now, I want to use one of them, without having to select them from a lengthy combo-box list.

The current form permits me to enter the material, which opens a report listing all of the records that contain the brokers names, pickup dates, etc, that I've used to haul that same material.

I was hoping to be able to pick, on the report, the broker name that I want to use for this trip and have it appear in the broker name field on the loads form.

That's all. Thanks.
 

GPGeorge

George Hepworth
Local time
Yesterday, 17:40
Joined
Nov 25, 2004
Messages
1,992
I understand what you wrote. Here is what I was hoping to achieve, if what I asked was possible.

I'm a trucking company person entering data in a new form that will include all of the information pertaining to a load, such as: the name of the broker I will use, eventually, pickup location, pickup date, destination location and the material that will be hauled.

In the past, I have used numerous brokers to haul the same load and, now, I want to use one of them, without having to select them from a lengthy combo-box list.

The current form permits me to enter the material, which opens a report listing all of the records that contain the brokers names, pickup dates, etc, that I've used to haul that same material.

I was hoping to be able to pick, on the report, the broker name that I want to use for this trip and have it appear in the broker name field on the loads form.

That's all. Thanks.
If, by report, you actually mean a report object, then it is possible to use it as you wish, but only if you open it in Report View, not Print Preview. There are limited events available in Report View. I haven't looked into the sample Eugene provided, but if it works that way, you could adapt it.

Typically, though, you would use a form, not a report, in this work flow. You could even embed that form as a subform in the header or footer of the base form and always filter it to show available brokers as the report would do.

Honestly, it's probably more a matter of the comfort level using the different objects than anything.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 08:40
Joined
May 7, 2009
Messages
19,246
and here is another demo of what you required.
 

Attachments

  • sampleHauling.accdb
    452 KB · Views: 181

Punice

Registered User.
Local time
Yesterday, 20:40
Joined
May 10, 2010
Messages
135
I think you should be using a form, select a control/record and process as you need.
I did use a form that held the broker names in a combo-box, starting in 2011. Now, that list contains 460 broker names that I can select from. It is a PIA to scroll down through all of them and associate the material with the brokers that I used to haul the material previously, to select which broker I want to use for this particular load.

Thank you for reading my post and responding to it.
 

Punice

Registered User.
Local time
Yesterday, 20:40
Joined
May 10, 2010
Messages
135
Thanks to all for responding to my post. The two example databases are stored in my pc. They will save me from having to think or scour the 'net in the future.
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 20:40
Joined
Feb 19, 2002
Messages
43,484
You can add a field to the shipper RowSource and sort first by the new field and then by the name. You don't need to show the new field or even select it. It isn't necessary to assign numbers to all of them. You just need to assign numbers to the few you want to pop to the top. If the default is null, sort descending so the three 1's sort to the top.
 

Punice

Registered User.
Local time
Yesterday, 20:40
Joined
May 10, 2010
Messages
135
You can add a field to the shipper RowSource and sort first by the new field and then by the name. You don't need to show the new field or even select it. It isn't necessary to assign numbers to all of them. You just need to assign numbers to the few you want to pop to the top. If the default is null, sort descending so the three 1's sort to the top.
I did something like what you suggested in a query to restrict the sort, in descending chronological order, by "Pickup Date', to isolate the broker names to those who were used to haul the material entered in the loads form. I entered this: "[Forms]![frmLOADS]![Material]" in the criteria field of the 'Material' field of the query that the report's 'Record Source'.

This enables all of the broker's names to be included in the report, which is what I wanted.

I no longer need what I, initially, requested help on, with this post.

Again, thank you and all others. I do appreciate this wonderful source of solutions this site provides.
 

Users who are viewing this thread

Top Bottom