multiple instances of forms

  • Thread starter multiple via AccessMonster.com
  • Start date
M

multiple via AccessMonster.com

How can we create multiple instances of forms which are independent to each
others.?
 
M

Marshall Barton

multiple said:
How can we create multiple instances of forms which are independent to each
others.?


The form must have an attached code module. THis makes it a
class and multople instances can be created the same as any
class.

Set myf = New Form_yourformobject

Theres more to managing multiple instances than that, but it
depends on what you are trying to accomplish and how you
want users to interact with the forms. Most likely, you
will want to use a collection to maintain a list of the
instances.

If you Google the newsgroups archives, I'm sure there are
some examples that might meet your specific needs.
 
A

asset number via AccessMonster.com

ok I have already accomplished that. what im trying to figure out now is how
do i generate a number that increments everytime a user inputs the same year
for multiple instance forms. example, i input 2004, it should display 001.
now if i click the add button to show my next instance form ,and input 2004
as the year it should display 002. on what im doing right now, it increments
but not on the instance form. instead it displays 001.

the sample on which i based my code could be found on this website.
http://allenbrowne.com/ser-35.html
 
R

Rick Brandt

asset said:
ok I have already accomplished that. what im trying to figure out now
is how do i generate a number that increments everytime a user inputs
the same year for multiple instance forms. example, i input 2004, it
should display 001. now if i click the add button to show my next
instance form ,and input 2004 as the year it should display 002. on
what im doing right now, it increments but not on the instance form.
instead it displays 001.

Assuning that you are deriving the "next" number in code by examining the table
then the problem is that the 001 record on the first form has not yet been saved
so the second form has no idea that 001 has already been used.

If you always save the current form when you open another one that migth solve
your problem. I don't really "get" why you need to open multiple instances like
this though. It is very unusual to do so when adding records.
 
A

asset number via AccessMonster.com

what i am tryin to accomplish is to have a db which generates an asset number
for each record that i input.
for each input year, it should have its own number of records. if i input
2004 as the year, it should generate a code of 001 for that record. i do this
3 more times, giving me 4 records. now if i input a different year, like 2005,
it should generate a new code, 001, assuming no 2005 records have been
inputted yet. and if i input 2004 as the year again, the code should be 005,
because i have 4 other existing records.

Rick said:
ok I have already accomplished that. what im trying to figure out now
is how do i generate a number that increments everytime a user inputs
[quoted text clipped - 3 lines]
what im doing right now, it increments but not on the instance form.
instead it displays 001.

Assuning that you are deriving the "next" number in code by examining the table
then the problem is that the 001 record on the first form has not yet been saved
so the second form has no idea that 001 has already been used.

If you always save the current form when you open another one that migth solve
your problem. I don't really "get" why you need to open multiple instances like
this though. It is very unusual to do so when adding records.
 
L

Larry Daugherty

Use DMax() on records of that year. Increment for the current form
and save the current form immediately. (Me.Dirty=False if you're not
yet done with the form)

HTH
--
-Larry-
--

asset number via AccessMonster.com said:
what i am tryin to accomplish is to have a db which generates an asset number
for each record that i input.
for each input year, it should have its own number of records. if i input
2004 as the year, it should generate a code of 001 for that record. i do this
3 more times, giving me 4 records. now if i input a different year, like 2005,
it should generate a new code, 001, assuming no 2005 records have been
inputted yet. and if i input 2004 as the year again, the code should be 005,
because i have 4 other existing records.

Rick said:
ok I have already accomplished that. what im trying to figure out now
is how do i generate a number that increments everytime a user
inputs
[quoted text clipped - 3 lines]
what im doing right now, it increments but not on the instance form.
instead it displays 001.

Assuning that you are deriving the "next" number in code by examining the table
then the problem is that the 001 record on the first form has not yet been saved
so the second form has no idea that 001 has already been used.

If you always save the current form when you open another one that migth solve
your problem. I don't really "get" why you need to open multiple instances like
this though. It is very unusual to do so when adding records.
 

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