repost - Can I post a record Automatically? Help!

G

Guest

Thanks for replying. More details:

The data entry form has 5 text boxes that fill 5 fields in my Transactions
table
Ref - Numeric
Date - Short Date
Supplier - Text
Project - Text
Value - numeric

I have set each of the text boxes in my form frmAutoTransactionEntry to the
following default values:
Ref - 99
Date - =date()
Supplier - TEST
Project - AA0000 (which is a test project)
Value - 0

There is a button which closes the form (and which normally would post the
record to the table)This is the only code on the form:
Private Sub CloseButton_Click()
On Error GoTo Err_Command_Click
Me.Refresh

If Me.Dirty Then
Me.Dirty = False
End If
DoCmd.Close acForm, "frmAutoTransactionEntry"

Exit_Command_Click:
Exit Sub

Err_Command_Click:
msgbox Err.Description
Resume Exit_Command_Click


End Sub

When the form opens the text boxes are populated with the default values,
but unless I amend the details in one of the text boxes the record is not
posted to the table. I suspect I need to force a change event to happen but I
don't know how. I put the me.refresh in to do this but it didn't work.
 
G

Guest

I think the reason your code is not working is because the form is not Dirty
yet. It does not become dirty until some value has changed. Since these are
the default values, they have not changed; therefore, no changes have
actually been made to dirty the form.

My first question is what are you wanting to do? Why would you want to
create or update a record with all defalut values?

Without knowing your end objective, I don't have an answer. If you will
post back with more info, I will see if there is a way to do this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top