Unbound field population in multiple row form

G

Guest

I have a form which displays 20+ rows in tabular format when invoked from a
pop-up form. I would like to populate 6 unbound fields for each record
correctly once the form has displayed the data and before the user has
started to move around the form. The population involves accessing sql
statements for each records Name field. After Update or insert events don't
fire because no data is changed/inserted, on current does not appear to fire
for each record until focus is attained in the record.

On navigating past the first 20 records, how best to continue displaying the
correct data for each record?

Do I have to manually move through the records using Me.NextRecord and
writing code off of this and then at the end move back to the FirstRecord?

Cheers
 
R

Rick Brandt

Ace9x said:
I have a form which displays 20+ rows in tabular format when invoked
from a pop-up form. I would like to populate 6 unbound fields for
each record correctly once the form has displayed the data and before
the user has started to move around the form. The population involves
accessing sql statements for each records Name field. After Update or
insert events don't fire because no data is changed/inserted, on
current does not appear to fire for each record until focus is
attained in the record.

On navigating past the first 20 records, how best to continue
displaying the correct data for each record?

Do I have to manually move through the records using Me.NextRecord and
writing code off of this and then at the end move back to the
FirstRecord?

Cheers

Put an expression in the query for the form and then it will automatically
be populated in all rows in the form. You might have to use a custom
function. As long as you are using form events it will not work well on a
continuous form.
 
G

Guest

4 of the unbound fields require sql statement extracts to populate, so a
custom function may be the correct way to go.
Created a public function within my generic code module passing through
required parameters from the function call within the Recordsource code and
put a msgbox statement to prove it is being called when built in the initial
query. Msgbox is not being displayed and no data is displayed on the form. I
have set references to data within function as Forms!Formname!fieldname. In
addition I now have to enter a parameter query value for Financial year which
wasn't there before.

Please help/guide me through the minefield!!!!!!
 
R

Rick Brandt

Ace9x said:
4 of the unbound fields require sql statement extracts to populate,
so a custom function may be the correct way to go.
Created a public function within my generic code module passing
through required parameters from the function call within the
Recordsource code and put a msgbox statement to prove it is being
called when built in the initial query. Msgbox is not being displayed
and no data is displayed on the form. I have set references to data
within function as Forms!Formname!fieldname. In addition I now have
to enter a parameter query value for Financial year which wasn't
there before.

Please help/guide me through the minefield!!!!!!

Don't feed it form references. Pass in other fields from the query as
arguments. Form references won't work in a continuous form.
 
G

Guest

Rick,
Apologies, I may not have stated things correctly before with regard to form
references.

The function in the recordsource has 3 parameters, 2 passed from columns
within the table in the recordsource statement, the 3rd parameter passed as
Forms!FormName.OpenArgs which changes dependent upon the original popup form
criteria.
Within the function itself, the fields on the record within the form to be
populated are referenced as Forms!FormName!fieldname. I cannot therefore see
how I can
remove these form references.

As an aside I put a dummy function with a MsgBox statement into the
recordsource to check if it was called ok, it only produced a single display
message even though I had 8 records displayed in the form. If this is to work
at record level, it would have called the function for each record displayed.
Have I missed something here or is it being invoked incorrectly?

Thanks for your thoughts.

Cheers,
Steve
 
R

Rick Brandt

Ace9x said:
Rick,
Apologies, I may not have stated things correctly before with regard
to form references.

The function in the recordsource has 3 parameters, 2 passed from
columns within the table in the recordsource statement, the 3rd
parameter passed as Forms!FormName.OpenArgs which changes dependent
upon the original popup form criteria.
Within the function itself, the fields on the record within the form
to be populated are referenced as Forms!FormName!fieldname. I cannot
therefore see how I can
remove these form references.

I'm afraid I don't understand what you are trying to do. It sounds like you
want to populate a continuous form with records from a query and in that
query use a function that references the same continuous form that is being
populated by the query. You can certainly reference items on a form, but
you a form reference will only see the ONE current record. There is no way
for a continuous form reference to pull different values from different rows
on the form because only one row actually exists at a time. The others are
just pixels on the screen.
 

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