If there is only one field, what's wrong with leaving it as the bound
control on your form?
If you really want to go the route of using an unbound form, you could add a
command button below the text box, and in its Click Event Procedure, execute
an Append query statement to add the record to the table. But is it really
worth that effort just so you can have sequential autonumbers? If this is
not a multi-user environmnet, could you use a Number field, and in
Form_BeforeUpdate assign DMax() + 1?
Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.MyNumber = Nz(DMax("MyNumber", "MyTable"), 0) + 1
End Sub
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
CK said:
Thanks Allen. Problem is that there is only one field which is the unbound
textbox. How do I push the value to a table or to any table for that
matter?
Or can I use the .ControlSource?
ck
Allen Browne said:
You could use the BeforeUpdate event of the form to write the value from
the
unbound box to the field, e.g.:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.[NameOfYourFieldHere] = Me.[NameOfYourUnboundTextBoxHere]
End Sub
How do I send a value in a control that is unbound later to a field in
a
table? I do not want to bind it upfront because it would increment my
autonumber. Thanks.
ck