refresh data

J

Joy

Hi I am a novice with MS Access. I have created a form with picklists
deriving from tables. I've also created a refresh button that some-what works
on the combox and txt fields. When I hit refresh, the data is all cleared on
the form. However, when I add to data to it without exiting first, not list
within the combo box is refreshed to meet new data requirements. If you have
any suggestions, would appreciate heaps!
 
J

Jeanette Cunningham

Joy,
are you trying to add a new record?
You need to save a new record before you try to add another record.
You can put code on that button to save the record instead of just
refreshing it.
The code would look like this:


If Me.Dirty = True Then
Me.Dirty = False
End If

Note: remove any code you already have for the existing button and replace
it with the code above
The dirty property of the form is set to True as soon as user puts entry in
the first textbox.
The line Me.Dirty = False forces Access to save the record by writing it to
disc.

Jeanette Cunningham
 
J

Joy

Hi Jeannette

I am trying to add a new record each time the refresh button is hit, hence a
clean form again without needing to exit. I don't need the records on the
form to be saved (MS Access saves automatically - yes?). When the form is
completed, it will get emailed to me. There is no requirement for me to have
the data saved or the user to save it on their end. As such, all fields on
form are unbound. Thanks
 
J

Jeanette Cunningham

Joy,
There is a mis-understanding about how Access works.
This bit is being misunderstood - MS Access saves automatically
Access saves automatically only if the form and the fields are bound.
If you make your form a bound form with the fields bound to its
recordsource, every time you move to add a new record, not only will the
data be saved in the tables, but the controls will be cleared, ready to take
the next record.

Jeanette Cunningham
 
J

Joy

Hi Jeanette
I am having trouble bind the control to a field in a tbl that I've created
I am binding it thru Control Source. When I turn my fom back into form view,
the control shows Error. What am I doing wrong?
 
J

Jeanette Cunningham

Joy,
--in design view
--select that control
--on its property sheet, on the data tab
--find Control Source (at top of list) on the same line click the drop arrow
--select one of the fields on the list
--save the form and switch to form view

This should fix the #error for that control, assuming a simple bound
control, and not a calculated control.

Jeanette Cunningham
 
J

Joy

Hi Jeanette
This is a simple bound control.... that does not seem to be so simple. There
are no calculations involved. I've been trying to bind the control as per
your instructions. I see the problem - in the property - control Source when
I hit the drop down arrow there is no table or fields. What do I need to do
for this to happen?
Thx Joy
 
J

Jeanette Cunningham

Joy,
to bind the form, build and save a query from the table or tables that are
needed to cover all the fields you want on your form.
In design view of the form, on the properties dialog, on the data tab,
--click the drop arrow on the text box next to Control Source
--choose the query you created above
--if your query includes all the fields you need for your form, you will be
able to bind each control.

Jeanette Cunningham
 

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

Similar Threads


Top