writing records to a table

G

Guest

have a form that has 48 text boxes. The user enters data into the unbound
text boxes first then after they review the information I move the
information from the unbound ( me.bound = me. unbound) to the bound text
boxes to add the record to the table. The first 3 to 5 records write to the
table, after that I am not sure what happens, but the records are not writing
to the table.

Thank you for any help.

Shari
 
G

Guest

What is the purpose of using the unbound controls?
Can you post the code you are using to move the data to the bound controls
and update the recordset?
 
G

Guest

Thank you for answering, the purpose of the unbound is that I did not want to
update the table until the user had a chance to review the data they inputed.
I created a command button to preview report before updating.

Code -
The me.v fields are the unbound and the me. aaol are the bound. I have a
command button and on the click event I move the me.v unbound fields to the
me.aaol bound fields
On the form I have my table name in the record source and allow additions
set to yes.
In the bound text box I have the control source set to table name.

Me.AAOL = Me.VAOL
Me.AARC = Me.VARC
Me.AARL = Me.VARL
Me.AAAC = Me.VAAC
Me.AAAL = Me.VAAL

Thank you for your help.
 
G

Guest

I'm a little lost here. You say you do a report preview. Is this an Access
Report in Print Preview? You have to have a table or query for that.

I really believe you are making it harder than it needs to be. You can
still use a bound form. You don't have to update the record until you want
to. you can allways have an Undo button. You can also add code to prevent
the user moving off the record or closing the form without either saving on
undoing the record. That is really a better approach.
 
G

Guest

It is an access report where the control source is the form. You are
probably right that I am making it harder, but I am new at access and I am
not sure how not to update a record until needed. I do have a command button
on the form for closing form without updating. If you could lead me in the
right direction, your help would be greatly appreciated.

Shari
 
G

Guest

The easiest way to force an update to a record is:

Me.Dirty = False

The Dirty property is automatically set to true as soon as you type the
first character into any bound control.

Now, what you need to check is where all an update can occur.
If you move away from the current record, it will update if it is Dirty.
If you close the form.

One way to control this is to create a module level boolean variable that
tells the form whether you want to allow the update. Declare the variable at
the top of the module before any procedures

Dim blnOkToSave As Boolean

Then set it to False in the form Current event.

blnOkToSave = False

Then in the Before Update event of the form:

If Not blnOkToSave Then
If MsgBox("Do You Want to Save Changes to This Records", _
vbQuestion + vbYesNo) = vbNo Then
Cancel = True
Me.Undo
End If
 

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