By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,510 Members | 1,477 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,510 IT Pros & Developers. It's quick & easy.

tricky form

P: n/a
hello, I'm trying to code a form that will output all data on from one
table into separate pages (can scroll through them using the arrows, or
entering a specific entry at the bottom), but on each page it will look
at the primary key for that table, then look at another table, and
wherever it contains a reference to that particular value, create a
textbox and output a memo onto...

since that was probably vague and confusing i will try to explain it
again with examples... I have a table called "Hazard table", it has
fields for "JSA Number", "Job Component Number", "Hazard Number"
<--(primary key), and "Hazard Description". I have another table called
"Control Measure Table", it has fields for "JSA Number", "Job Component
Number", "Hazard Number" <--(refers to "Hazard number" in "Hazard
table"), "Control Measure Number" <--(primary key), and "Control
Measure Description".

now what I want the form to do, is for each "Hazard Number" in "Hazard
Table" output the description for it, and output any description from
the "Control Measure table" that has a matching "Hazard Number"... I
would like it to display such that it creates a TextBox and displays
the descriptions for each hazard description (with a button at the
bottom to create a new hazard) so that the data can be edited, and then
create TextBoxes to the right of the hazard description, one for each
control desciption (again, with a button at the bottom to create a new
control measure)

the primary keys for both tables are set up as autonumbers, and the
hazard number in the control measure table is supposed to be given the
value of the hazard number its being created with...

currently my chief trouble is figuring out how to access the two tables
and use the relation between the two within the form itself... then i
still havent quite figured out how to have it create the textboxes it
needs as its goes (i dont want to have a bunch of textboxes not visible
or anything like that)... I'm not that good with VB, your help would
be appreciated... thanks in advance, and sorry that my post is long and
a bit hard to read

Jul 12 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a
ok, so here is a revised request, since my last was rather... confusing
to say the least...

I am creating a form that will show data from one table, one entry per
page, and on each page it also needs to show data related to that entry
from another table... the data needs to be output into textboxes so
that it can be edited. the number of entries from the related table
associated with the entry from the main table vary, and each entry
needs to be output into a separate textbox. how would i code this so it
would go through a for each loop that looks at all entries in the
second table and, for each entry that has a matching link to main
table, create a textbox and insert the data from the table into it...
at the bottom of the page.

I am also uncertain how to code a button that will adjust the position
of itself and create a new textbox where it had been (whatever data
gets entered into it then needs to be added to the table... im not
certain if some of the fields being autonumbers complicate or simplify
the matter)

I know this is still probably difficult to read and understand, please
ask me questions to clarify and i try to as best as i can

Jul 13 '06 #2

P: n/a
wr***********@gmail.com wrote in
news:11**********************@m73g2000cwd.googlegr oups.com:
ok, so here is a revised request, since my last was rather...
confusing to say the least...

I am creating a form that will show data from one table, one
entry per page, and on each page it also needs to show data
related to that entry from another table... the data needs to
be output into textboxes so that it can be edited. the number
of entries from the related table associated with the entry
from the main table vary, and each entry needs to be output
into a separate textbox. how would i code this so it would go
through a for each loop that looks at all entries in the
second table and, for each entry that has a matching link to
main table, create a textbox and insert the data from the
table into it... at the bottom of the page.

I am also uncertain how to code a button that will adjust the
position of itself and create a new textbox where it had been
(whatever data gets entered into it then needs to be added to
the table... im not certain if some of the fields being
autonumbers complicate or simplify the matter)

I know this is still probably difficult to read and
understand, please ask me questions to clarify and i try to as
best as i can

It sounds like you are trying to reinvent the wheel.

Instead of putting the textboxes directly on the form, create a
subform which contains the textbox.
--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Jul 13 '06 #3

P: n/a
the problem is that there is an undetermined amount of textboxes... the
main form will have a number of textboxes, and each of those textboxes
would have a subform which contain a number of textboxes... the number
of textboxes in the main form depends on which record the form as a
whole is looking at, and the number of textboxes in the subform would
depend on which textbox it was associated with... it all varies... i
know i could just manually create all these textboxes, and only make
them visible if there is information to populate them with... but there
could be as many as 10 textboxes in the subform, and as many as 10
textboxes (and therefore 10 subforms) in the main form... of course
there will never be any instance where there are 10 subforms with each
with 10 textboxes... but there will be times when there are 10
subforms, and there will be times when there are 10 textboxes... it
also gets deeper in that the subforms would need to have their own
subform... but im not concerned about that quite yet

It sounds like you are trying to reinvent the wheel.

Instead of putting the textboxes directly on the form, create a
subform which contains the textbox.
--
Bob Quintal
Jul 13 '06 #4

P: n/a
i need to do something sorta like this i suppose...

http://www.tek-tips.com/faqs.cfm?fid=5757

i need to do it in access of course, and instead of just going from
1-10, it needs to look at the database, count the number of entries in
the related table that correspond with the entry in question in the
main table, and create that many textboxes and populate them with the
entries from the related table...

Jul 13 '06 #5

P: n/a
wr***********@gmail.com wrote in
news:11*********************@m79g2000cwm.googlegro ups.com:
the problem is that there is an undetermined amount of
textboxes...
Wrong. the number of textboxes depends on the number of fields
in the underlying table. That is known at design time.

the main form will have a number of textboxes,
and each of those textboxes would have a subform which contain
a number of textboxes...
Wrong. each record in the main table would would have a subform.
The subform can have several rows. Sometimes you can have two
subforms, each related to a different field in the main form.

the number of textboxes in the main
form depends on which record the form as a whole is looking
at, and the number of textboxes in the subform would depend on
which textbox it was associated with... it all varies... i
know i could just manually create all these textboxes, and
only make them visible if there is information to populate
them with... but there could be as many as 10 textboxes in the
subform, and as many as 10 textboxes (and therefore 10
subforms) in the main form... of course there will never be
any instance where there are 10 subforms with each with 10
textboxes... but there will be times when there are 10
subforms, and there will be times when there are 10
textboxes... it also gets deeper in that the subforms would
need to have their own subform... but im not concerned about
that quite yet
>
>It sounds like you are trying to reinvent the wheel.

Instead of putting the textboxes directly on the form, create
a subform which contains the textbox.
--
Bob Quintal


--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Jul 13 '06 #6

P: n/a
this still doesnt help me... I understand what you are saying, I just
dont know how to go about implementing something like that...

Jul 13 '06 #7

P: n/a
wr***********@gmail.com wrote in
news:11*********************@s13g2000cwa.googlegro ups.com:
this still doesnt help me... I understand what you are saying,
I just dont know how to go about implementing something like
that...

Perhaps if you showed some sample data it might be easier to
explain.
--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Jul 13 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.