Trying to add blank box to form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a DB setup that keeps track of 4 things. Customer, Legal, Date, and
Margin. Depending on the type of form the user requires all data is run
through on query, or another. The problem I am having is that say they run a
query that pulls up 4 entries. I need on the form 4 blank boxes that follow
each line so that the user can enter temporary data here that is then printed
via certain reports they select. Where I am stuck is that I need to use
Tabular, or Datasheet forms so all data is displayed at the same time on the
same form. Unfortunately if I try to add a blank text box to the form I can
get it after every line, but if they enter in say +400 it shows in all the
boxes for every line. I need each box to be a seperate box so that after line
1 they may enter +400, but after line 2 it may be -150. Any help would be
greatly appreciated on this.

C_Ascheman
 
In
C_Ascheman said:
I have a DB setup that keeps track of 4 things. Customer, Legal,
Date, and Margin. Depending on the type of form the user requires all
data is run through on query, or another. The problem I am having is
that say they run a query that pulls up 4 entries. I need on the form
4 blank boxes that follow each line so that the user can enter
temporary data here that is then printed via certain reports they
select. Where I am stuck is that I need to use Tabular, or Datasheet
forms so all data is displayed at the same time on the same form.
Unfortunately if I try to add a blank text box to the form I can get
it after every line, but if they enter in say +400 it shows in all
the boxes for every line. I need each box to be a seperate box so
that after line 1 they may enter +400, but after line 2 it may be
-150. Any help would be greatly appreciated on this.

C_Ascheman

Hi C_Ascheman,

This happens because the text box you add is not bound to data in the query
or table. In this case, the text box will have the same value in every row
on your form.

The only way I know how to make this work is to add a field to your table,
and add this field to your queries as well. Then bind this field to the
text box. The user can now type in whatever he/she wants, and the value can
be different for every row. The value the user added will even be
automatically saved between sessions ;)

This setup doesn't work when you work with multiple users on the same
database, since the value in the extra text box is really stored in the
table. In this case you would need to assign user ID's to each user; a good
way to do this is by securing the database so people have to log in to use
it.

You could then make a separate table for the 'comments' text box, and store
the values in this table. You would need three columns in this table;
- one containing the primary key of the main table's record,
- one containing the user's loginname or ID, and
- one containing the comment itself
The main table will need to have a primairy key column added if it hasn't
got one already, and it should not have the 'comment' column anymore.

Your queries would also need to be changed; you would have to use a join in
them to pull the correct values from both the main table and the comment
table (also including the user ID column), putting the join on the primary
key and an extra WHERE to select the correct user's entry.

You should then also add a (hidden) text box to your main form that is bound
to the user ID column of the query, and make it's default value the ID of
the current user.

I haven't tested the above approach, nor have I got much experience with
updating and adding of such Joined queries via a form, so it may be faulty
at points. If so, someone please correct me!

Kind regards,
Carl Colijn

--
TwoLogs - IT Services and Product Development
A natural choice!
http://www.twologs.com
TimeTraces: the powerfull and versatile time registration system!
http://www.twologs.com/en/products/timetraces.asp
 
Back
Top