Form data entry problem

Jemmo

Registered User.
Local time
Today, 16:12
Joined
Jul 28, 2008
Messages
82
I have a form on which there a list box (based on a 2-column table), and two text-boxes which are bound to the same table.

I want to be able to enter data into the two text boxes, click a button and append a row to the table. The new record should then be visible in the list box.

However, when I enter data in textbox 1 and tab to textbox 2, the value in textbox1 is inserted to the table. I only want to add the data when there is a value in both text boxes.

What am I doing wrong?
 
as soon as you enter data, access will try and create the record

if you have both textbox fields set as "required", then if you try to exit you will get a "cant save error" - you could intercept this, and keep the user on the active record

alternatively, use an unbound form, and append the record with a recordset when you are happy with the input
 
The daft thing is, I have done exactly this for another form - and it works with bound text boxes.

I have managed to get it working albeit slightly different from the first form I used this method on.

Ah well, C'est la vie!
(as they say in Dover)
 
Access doesn't try to create a new record but does, in fact, create a new record when the first character is entered, but it does not save a record when moving from the first textbox to the second textbox! If this is truly happening, then either
  1. You've placed some code tied to the first textbox to explicitly force a save of the record
  2. You have some form of corruption
  3. You're actually moving to another new record when you tab
If the first textbox you're filling in actually is the last control in the Tab Order then # 3 above could be the problem. Try doing this:

In Design View, for the form, goto Properties - Other and set the Cycle Property to Current Record and see if this stops the problem.
 

Users who are viewing this thread

Back
Top Bottom