Avoid Creating Auto Number Field

  • Thread starter Thread starter Mike Thomas
  • Start date Start date
M

Mike Thomas

I am working on an unbound form which has the sole purpose of adding
records. A temp table which matches the layout of the permanent table is
needed, so I've used the following code to make the table:


On Error Resume Next
CurrentDb.TableDefs.Delete "tt_rct"
On Error GoTo 0

strSQL = "SELECT receipt.* INTO tt_rct " & _
" FROM receipt WHERE false;"
CurrentDb.Execute (strSQL)


I then add the record, do the edit, then insert the record into the
permanent table if all the data is valid.

Problem is, there is an auto number ID field in the permanent table
[receipt] which is inherited by the temp table. Is there a way to avoid
having the auto number field designated as an auto number field in the temp
table. (I can work aroung the auto number field, but am curious).

Many thanks
Mike Thomas
 
Mike,

Don't use a temp table. Put a command button on your unbound form and use
the On Click event to validate the entered data and add it as a new record
to your table. You can create variables for each of the fields on the form,
validate the entered data and then add a new record to your table using the
values of your variables.

Ken
 
Thanks Ken,

That works for the header record. Eventually I'll add a sub form for detail
records (it's a part receiving form), so I'll definitely need to use a temp
table there.

Mike Thomas


Ken Warthen said:
Mike,

Don't use a temp table. Put a command button on your unbound form and use
the On Click event to validate the entered data and add it as a new
record
to your table. You can create variables for each of the fields on the
form,
validate the entered data and then add a new record to your table using
the
values of your variables.

Ken

Mike Thomas said:
I am working on an unbound form which has the sole purpose of adding
records. A temp table which matches the layout of the permanent table is
needed, so I've used the following code to make the table:


On Error Resume Next
CurrentDb.TableDefs.Delete "tt_rct"
On Error GoTo 0

strSQL = "SELECT receipt.* INTO tt_rct " & _
" FROM receipt WHERE false;"
CurrentDb.Execute (strSQL)


I then add the record, do the edit, then insert the record into the
permanent table if all the data is valid.

Problem is, there is an auto number ID field in the permanent table
[receipt] which is inherited by the temp table. Is there a way to avoid
having the auto number field designated as an auto number field in the
temp
table. (I can work aroung the auto number field, but am curious).

Many thanks
Mike Thomas
 
Back
Top