MS Access Forum / New Users / February 2008
Data not refreshing on form
|
|
Thread rating:  |
Joy - 06 Feb 2008 23:26 GMT Hi, A beginner with Access who needs lots of help.. I've a form for users to enter, the fields are not bound to a table. I would like to create a refresh button so that user can do another addition. I've tried coding with Me.Requery on the Refresh button but nothing happens. The current data stays.
I've also tried If Me.Dirty = True Then Me.Dirty = False End If
What else should I try?
Thanks Heaps, Joy
Jeanette Cunningham - 06 Feb 2008 23:50 GMT Joy, to use unbound form to do this, you need to create an append query that will add the data from the controls on the form to the whichever table or tables you want the data to go into. Place a save button on the form. Code the click event of the button to run the append query.
It is much more work to use unbound forms - you have to write code for everything. If you use bound forms, there is a lot of built in stuff that automatically saves records. That makes it quicker and easier to use. Bound forms are one of the main benefits of using Access.
How did you go with creating that bound form we discussed yesterday - are there still some things that need fixing to make it work properly?
Jeanette Cunningham
> Hi, A beginner with Access who needs lots of help.. > I've a form for users to enter, the fields are not bound to a table. [quoted text clipped - 10 lines] > > Thanks Heaps, Joy Joy - 07 Feb 2008 00:03 GMT Hi Jeanette I just realised I made a typo mistake... I did get the fields to be bound to a table. All fields are now bound. Sorry!
Hence, my predicament now... its not refreshing :-( with the codes I tried
Thx Joy
> Joy, > to use unbound form to do this, you need to create an append query that will [quoted text clipped - 28 lines] > > > > Thanks Heaps, Joy Jeanette Cunningham - 07 Feb 2008 00:12 GMT Joy, If you have a save button on your bound form, you will need code to make the record save. The code is:
If Me.Dirty Then Me.Dirty = False End If
To add the code: --in design view click the button --on the properties dialog, fine the event called On Click --click the button on the right side with the ellipsis (...) --choose Code Builder --between the Private Sub and the End Sub --type the 3 lines of code at the top of this post.
However if you don't use a close button, and just use the redX at top RHS of form, the data will save automatically. If this doesn't work for you, post back with details.
Jeanette Cunningham
> Joy, > to use unbound form to do this, you need to create an append query that [quoted text clipped - 28 lines] >> >> Thanks Heaps, Joy Joy - 07 Feb 2008 01:14 GMT Hi Jeanette,
Thanks for your help...The record in bound form is saving on to the table. In the Save cmd button
I used the code you gave below:
If Me.Dirty Then Me.Dirty = False End If
But how should I get the form to refresh... so that when I hit the refresh button, all data showing on form is cleared and I can use it to add another..or what code should I use... as Me.Refresh does not work either:-(
Thanks Joy
> Joy, > If you have a save button on your bound form, you will need code to make the [quoted text clipped - 51 lines] > >> > >> Thanks Heaps, Joy Joy - 07 Feb 2008 01:23 GMT Hi Jeanette
I just realised that refreshing according to Help files functions to " updates the data that already exists in your datasheet or form". What I really would like (not sure of terminology) is that when I hit the refresh button on the form, current data disappears, form is clean for a new entry. Could you pls help me..
Thanks Joy
> Joy, > to use unbound form to do this, you need to create an append query that will [quoted text clipped - 28 lines] > > > > Thanks Heaps, Joy Jeanette Cunningham - 07 Feb 2008 02:11 GMT You need to go to the next new record. The easy way to do this is to set up the form to show the navigation buttons. Open the form in design view, on the properties dialog, on the Format tab, set the property Navigation Buttons to Yes, save and open in normal view, down the botton of the form will be a set of button, to go to a new record, click the button with the star or asterisk on it. That button will automatically save the current entered data and take you to the next new record.
Jeanette Cunningham
> Hi Jeanette > [quoted text clipped - 42 lines] >> > >> > Thanks Heaps, Joy Joy - 07 Feb 2008 02:34 GMT The Navigation buttons are set to yes (its default) I don't seem to have as an option "save and open in normal view" or "go to a new record" in the Format tab.. I checked the All tab too...
> You need to go to the next new record. > The easy way to do this is to set up the form to show the navigation [quoted text clipped - 57 lines] > >> > > >> > Thanks Heaps, Joy Jeanette Cunningham - 07 Feb 2008 03:39 GMT Save and open in normal view - I really meant - you have finished changing the form. Close and save it. Now open it in normal view. Test to see if it works the way you want.
Jeanette Cunningham
> The Navigation buttons are set to yes (its default) > I don't seem to have as an option "save and open in normal view" or "go to [quoted text clipped - 68 lines] >> >> > >> >> > Thanks Heaps, Joy Joy - 07 Feb 2008 03:58 GMT Strange. When I hit the save button, the form looks the same, no changes took place. Its only when I move my mouse wheel forward that the form became blank for me to put in my next entry. I was under the impression that when I hit the save button, all values in the form will disappear. I am not sure if all my users have a mouse with a mouse wheel.
> Save and open in normal view - I really meant - you have finished changing > the form. Close and save it. Now open it in normal view. [quoted text clipped - 74 lines] > >> >> > > >> >> > Thanks Heaps, Joy Rick Brandt - 07 Feb 2008 04:11 GMT > Strange. When I hit the save button, the form looks the same, no > changes took place. Not strange at all as that is exactly what you should expect.
>Its only when I move my mouse wheel forward that > the form became blank for me to put in my next entry. Because the mouse wheel will navigate the form to different records. When you are on the last record and navigate forward you end up at the new record position.
> I was under the > impression that when I hit the save button, all values in the form > will disappear. Don't know where you would get that impression. Access forms have never behaved that way.
> I am not sure if all my users have a mouse with a > mouse wheel. The mouse wheel is not the only way to navigate. Hitting > or >* in the navigation buttons will do the exact same thing. As will pressing PageDown or using Records Go To - New on the menu bar.
 Signature Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com
Jeanette Cunningham - 07 Feb 2008 04:14 GMT If you want that behaviour, change the code behind the button to this:
On Error Resume Next If Me.Dirty = True Then Me.Dirty = False End If DoCmd.GoToRecord acActiveDataObject, , acNewRec
Jeanette Cunningham
> Strange. When I hit the save button, the form looks the same, no changes > took [quoted text clipped - 95 lines] >> >> >> > >> >> >> > Thanks Heaps, Joy Joy - 07 Feb 2008 04:26 GMT Hi Jeanette
THANKS SO MUCH!!!! It works. Thank you for your patience!
Cheers Joy
> If you want that behaviour, > change the code behind the button to this: [quoted text clipped - 106 lines] > >> >> >> > > >> >> >> > Thanks Heaps, Joy Jeanette Cunningham - 07 Feb 2008 04:46 GMT You're very welcome.
Jeanette Cunningham
> Hi Jeanette > [quoted text clipped - 127 lines] >> >> >> >> > >> >> >> >> > Thanks Heaps, Joy Jeff Boyce - 06 Feb 2008 23:50 GMT Joy
If I'm understanding your description, you have a form in which your users enter data, but that form is not bound to a table.
So, how does Access know "where to stick it?"
Regards
Jeff Boyce Microsoft Office/Access MVP
> Hi, A beginner with Access who needs lots of help.. > I've a form for users to enter, the fields are not bound to a table. [quoted text clipped - 10 lines] > > Thanks Heaps, Joy Joy - 07 Feb 2008 00:03 GMT Hi Jeff
I made a typo mistake.. the fields are bound. I can't get it to refresh:-(
Thx Joy
> Joy > [quoted text clipped - 22 lines] > > > > Thanks Heaps, Joy John W. Vinson - 06 Feb 2008 23:53 GMT >Hi, A beginner with Access who needs lots of help.. >I've a form for users to enter, the fields are not bound to a table. [quoted text clipped - 9 lines] > >Thanks Heaps, Joy Well, Refresh reloads the data from the table to which the form is bound, and Dirty applies when a bound control is updated. Neither is meaningful for an unbound form.
Why are you using an unbound form, at all? What's the point in entering data that will be displayed on screen while the form is open and never put anywhere else - or do you have VBA code to take the data from the unbound form and put it into tables? If so, why do it the hard way rather than simply using a bound form?
Background please!
John W. Vinson [MVP]
Joy - 07 Feb 2008 00:04 GMT Hi John
Typo mistake.. the controls are bound to a table. Just that codes I used for refreshing the form is not working:-(
Thx Joy
> >Hi, A beginner with Access who needs lots of help.. > >I've a form for users to enter, the fields are not bound to a table. [quoted text clipped - 23 lines] > > John W. Vinson [MVP] John W. Vinson - 07 Feb 2008 01:07 GMT >Hi John > >Typo mistake.. the controls are bound to a table. >Just that codes I used for refreshing the form is not working:-( What's the Recordsource of the form? Please post the SQL. What are the control sources of the fields you want refreshed? What's your code? Why do you need a Refresh at all? It wouldn't *routinely* be necessary.
John W. Vinson [MVP]
|
|
|