Passing control values

N

NoodNutt

G'day all

been a while since I have done any DB work and am rusting as.

Need some shock treatment on passing values from one form to another whence
the second opens.

eg

frmCustomers | txtName, txtSuburb & txtPhone

I need to copy the values from each of the controls and pass them onto

frmPickUpPoint | txtName through to txtPhone

I know how to pass the value by code in a combo AfterUpdate on the same
form, but I'm a little vague on the form to form.

I know some of you will tell me to use a combo on the second form but I need
to speed the input process as the customer service & dispatch areas that
will use this DB are recieving call at a phenominal rate and won't have time
to waste on additional keystroking or mouse clicking.

TIA
Mark
 
R

Rick Brandt

NoodNutt said:
G'day all

been a while since I have done any DB work and am rusting as.

Need some shock treatment on passing values from one form to another
whence the second opens.

eg

frmCustomers | txtName, txtSuburb & txtPhone

I need to copy the values from each of the controls and pass them onto

frmPickUpPoint | txtName through to txtPhone

I know how to pass the value by code in a combo AfterUpdate on the
same form, but I'm a little vague on the form to form.

Open the second form then use code identical to what you describe above
replacing "Me" with "Forms!SecondFormName". Then close the first form.
 
N

NoodNutt

G'day Rick
Thx heaps for your reply
If I may pick your brain for a second time.

In the On_Open of my SecondForm I would have something like the following

Me.CustName = Forms!MyFirstForm!CustName

And so on

finishing off with

DoCmd.Close AcForm "MyFirstForm", NoSave

Mark.
 
R

Rick Brandt

NoodNutt said:
G'day Rick
Thx heaps for your reply
If I may pick your brain for a second time.

In the On_Open of my SecondForm I would have something like the
following
Me.CustName = Forms!MyFirstForm!CustName

And so on

finishing off with

DoCmd.Close AcForm "MyFirstForm", NoSave

Well that's one way. You are "pulling" the data from the first form using
code in the second. You could also "push" the data into the second form
with code running in the first. Pulling in general is better than pushing
in my experience.

I would suggest first testing in your code that Forms!MyFirstForm is
actually opened so that your second form can also be opened normally without
generating errors.
 
N

NoodNutt

Well Rick

I have probably forgotten more than I learnt over the years, specially
considering I have updated from 97 to 07.

I know I have the syntax of this all arse about, so can you clarify what I
am doing wrong please.

Me.PupName = Forms!frmCustomers!CustName

this envokes an runtime error '-2147352567 (80020009)': You can't assign a
value to this object.

should it be something like

Form!PupName = Forms!frmCustomers!CustName
or
Me.PupName = [Forms]!"frmCustomers"![CustName]
or
Me.PupName = Forms!frmCustomers.CustName


Sorry to be a pain

Regards
Mark
 
R

Rick Brandt

NoodNutt said:
Well Rick

I have probably forgotten more than I learnt over the years, specially
considering I have updated from 97 to 07.

I know I have the syntax of this all arse about, so can you clarify
what I am doing wrong please.

Me.PupName = Forms!frmCustomers!CustName

this envokes an runtime error '-2147352567 (80020009)': You can't
assign a value to this object.

should it be something like

Form!PupName = Forms!frmCustomers!CustName
or
Me.PupName = [Forms]!"frmCustomers"![CustName]
or
Me.PupName = Forms!frmCustomers.CustName


Sorry to be a pain

Regards
Mark

Try the Load event rather than the Open event. Open might be too soon.

Also assuming "PupName" is the name of a TextBox on your form is it
definitely capable of taking the value? It cannot be bound to an expression
nor to a non-editable field. In other words you can enter values into the
control manually right?
 
N

NoodNutt

You were right on the money with the On_Load.

Thx heaps again for your assistance Rick

Regards
Mark.
 
N

NoodNutt

Rick

Ran into snag with the On_Load procedure

It works fine from a single entry point, by that I mean when the Customer
Service team use it to enter relavent details.

Snag is when the Dispatcher accesses the form from a different entry point
from his form I get a debug error.

So I look like having to Push the data across rather than Pulling.

Any thoughts, and guidance on how to acheive the Push please.

TIA
Mark.
 
N

NoodNutt

All good Rick

Decided to make a copy of form in question and rename it for exclusive use
by the dispatcher.

working well

Thx again
Mark.
 

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