add textbox information to the table data and get it in

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

Guest

let's say i have such a structure for a table:

| year | product | amount |

i have a form, using text box'es like this:

<year>
<product> <amount>
<product> <amount>
....
<product> <amount>
(some of textbox'es (products and amounts) can be empty.)

i want to add these data to the table. how can it be done?

:::::: part 2 :::::::::
is it possible to get data from the table using similar form so that - when the user chooses a year, all the textbox'es are filled with the products and amounts of the year?
 
Stilets,

If you look at the Properties of the form, you will see a property
called Default View. If you set this to Continuous Forms, you will be
able to see multiple records listed in the kind of layout that you
describe. Just to clarify your meaning, you should only have one
textbox for product and one textbox for amount in the design of your form.

If you put an *unbound* textbox in the Form Header section, let's say
you name it YearSelector, and then make a query based on your table, and
make this query the Record Source of your form, you can refer to this
textbox in the Criteria of the Year field in the query, like this...
Nz([Forms]![NameOfYourForm]![YearSelector],"*")
.... so then when you enter a year in the YearSelector textbox, only the
records for that year will be shown in the form.

As a complete side issue, the word "year" is a Reserved Word (has a
special meaning) in Access, and as such it is not a good idea to use it
as the name of a field or control.
 
It seems to be the right solution. Thank you!

But - how can I make the query update and put on the form only the necessary records? (I have all the records (not the records of the selected year).)


Steve Schapel said:
Stilets,

If you look at the Properties of the form, you will see a property
called Default View. If you set this to Continuous Forms, you will be
able to see multiple records listed in the kind of layout that you
describe. Just to clarify your meaning, you should only have one
textbox for product and one textbox for amount in the design of your form.

If you put an *unbound* textbox in the Form Header section, let's say
you name it YearSelector, and then make a query based on your table, and
make this query the Record Source of your form, you can refer to this
textbox in the Criteria of the Year field in the query, like this...
Nz([Forms]![NameOfYourForm]![YearSelector],"*")
.... so then when you enter a year in the YearSelector textbox, only the
records for that year will be shown in the form.

As a complete side issue, the word "year" is a Reserved Word (has a
special meaning) in Access, and as such it is not a good idea to use it
as the name of a field or control.

--
Steve Schapel, Microsoft Access MVP

let's say i have such a structure for a table:

| year | product | amount |

i have a form, using text box'es like this:

<year>
<product> <amount>
<product> <amount>
...
<product> <amount>
(some of textbox'es (products and amounts) can be empty.)

i want to add these data to the table. how can it be done?

:::::: part 2 :::::::::
is it possible to get data from the table using similar form so that - when the user chooses a year, all the textbox'es are filled with the products and amounts of the year?
 
Stilets,

You might need to put soem code like this...
Me.Requery
.... on the AfterUpdate event of the YearSelector textbox.
 
It works! Thank you!

Steve Schapel said:
Stilets,

You might need to put soem code like this...
Me.Requery
.... on the AfterUpdate event of the YearSelector textbox.
 
Back
Top