toom
04-12-2011, 12:04 PM
I just started (again) with vba, well I used it quite a lot in 2006 but that's some time ago and I can not remember everything. Anyway I created a table called auto and it contains the following fields
id PRIMARY
brand
age
power
I also created a form called autoform. Within that form I created three textfields added the tabel auto to the form as Record Source and as Control Source I added a table field for each textfield in my form. Now, I already filled my table with some values:
id brand age power
1 Mecedes 13 129
2 Audi 3
3 Porsche 2
4 BMW 2
*
If I now open the form my textfield are populated with the values of the row with id, ie. Mercedes 13 and 129. If I delete all these textfields and enter some new entries I would expect that I added a whole new line like Toyota,4,134 with new id 5. But that does not happen instead the row with id is altered and the old values get substituted with toyoty,4,134.
Why does this happen? How do I tell my form that i should add a new dataset to my table?
id PRIMARY
brand
age
power
I also created a form called autoform. Within that form I created three textfields added the tabel auto to the form as Record Source and as Control Source I added a table field for each textfield in my form. Now, I already filled my table with some values:
id brand age power
1 Mecedes 13 129
2 Audi 3
3 Porsche 2
4 BMW 2
*
If I now open the form my textfield are populated with the values of the row with id, ie. Mercedes 13 and 129. If I delete all these textfields and enter some new entries I would expect that I added a whole new line like Toyota,4,134 with new id 5. But that does not happen instead the row with id is altered and the old values get substituted with toyoty,4,134.
Why does this happen? How do I tell my form that i should add a new dataset to my table?