refresh an unbound form after data altered

D

David

hi
I have created an unbound form that I would like to update some fields
when I alter the figures in one part of the form.
is there any way of refreshing the form when I lose focus without
reopening the form
 
M

Maha Arupputhan Pappan

David,

I agree with June7. I used Refresh method in most forms and they just serve
the purpose.
 
D

David

Hi June7
I am a new user and when I go to Design view to enter
Forms(fm_addCleanNew).Refresh in the lost focus of the field

When i go into the form View and enter the data
it comes back and says that it can't find a Macro called
(fm_addCleanNew).Refresh
'

What have I misinterpreted?

Fm_addClean is the name of the form I am using




June7 via AccessMonster.com said:
There are several form events that you could try: OnDirty, OnLostFocus,
OnDeactivate. Code:
Forms("formname").Refresh or Forms("formname").Requery
 
J

John W. Vinson

Hi June7
I am a new user and when I go to Design view to enter
Forms(fm_addCleanNew).Refresh in the lost focus of the field

When i go into the form View and enter the data
it comes back and says that it can't find a Macro called
(fm_addCleanNew).Refresh
'

Don't put it there. Erase what you have in the event, and click the ... icon
by it. Choose "Code Builder". Access will put you into a VBA editor with a Sub
and an End Sub line. Put June's code between those lines:

Forms("fm_addCleanNew").Refresh

or, since the code is on the same form, you can use a shortcut: just use

Me.Refresh
 
D

David

Hi June7

what I have is a form that I use to record Vehicles being cleaned
to make it easier on entry
we have created a form

That enables us to enter the date , type of wash and location

and put in the vehicle no this brings up the associated vechile Nos after
presing enter (there is a query that takes the data and puts it into the
correct table) and we just keep changing the vehicle No but without
exiting the form it does not bring up the associated nos

ie
car Trailer trailer

as the car is the unique no we would enter the car No and move to next tab
it would populate the two trailer nos

Without exiting we would change the car no and wanting the Trailer cars to
automatically update however as previous stated this is an unbound form

Hopes this explains what I am looking for

June7 via AccessMonster.com said:
Just hit me you said 'unbound' form and that we really don't have all info to
adequately respond. If form is unbound then what needs to be refreshed? An
unbound form has no recordset and Refresh is used to update a form's
recordset. Also, what exactly is losing focus? By 'alter figures in one part'
do you mean enter value into a textbox? What is the relationship between this
object and the objects you want refreshed. What kind of objects (combo or
list boxes) and what about them needs to be refreshed?
 
D

David

Thnks for your help June7

I can get it working if I put = CarNo in control source
but not if I use Dlookup command
but it wont work otherwise

I have decided against further efforts as it is outside my Knowledge of
Access

again thanks


June7 via AccessMonster.com said:
Okay, am starting to follow. You want entry in a textbox to force update of
two other text (not combo or list?) boxes and the form is not bound to a
table. Forget using form events. You can use DLookup function in these two
boxes ControlSource property:
=DLookup("trailer1field", "tablename", "carNofield='" & [textboxcarNo] & "'").

The table has two fields for the trailer numbers? I am using alias names here
because I don't know your field names and they need to be in quote marks and
note the apostrophe delimiter, this is needed if the values in the table
field are text (if a date use # symbol, if numeric, nothing). Go to Access
help for more explanation on DLookup (and other domain functions).
Hi June7

what I have is a form that I use to record Vehicles being cleaned
to make it easier on entry
we have created a form

That enables us to enter the date , type of wash and location

and put in the vehicle no this brings up the associated vechile Nos after
presing enter (there is a query that takes the data and puts it into the
correct table) and we just keep changing the vehicle No but without
exiting the form it does not bring up the associated nos

ie
car Trailer trailer

as the car is the unique no we would enter the car No and move to next tab
it would populate the two trailer nos

Without exiting we would change the car no and wanting the Trailer cars to
automatically update however as previous stated this is an unbound form

Hopes this explains what I am looking for
Just hit me you said 'unbound' form and that we really don't have all info to
adequately respond. If form is unbound then what needs to be refreshed? An
[quoted text clipped - 13 lines]
Less Spam Better enjoyable experience
Visit : news://spacesst.com
 
D

David

Hi june 7
I have had a rethink and the DLookupstatement is not working

However I have fiound that by changing my car no (as you know it doesn't
bring back the corresponding Trailer Nos)

I have noticed that when I goto design view and then back to Form View and
it updates the trailer car nos.

I guess the question I am know asking is there a way I can get the form to
refresh after I change the car NO

Hopeful David

June7 via AccessMonster.com said:
Have to correct my correction. Guess trying to give advice after midnight not
great idea.
Regarding the DLookup statement: My first example is for use in textbox
ControlSource property, the second would be used in VBA code.
Sorry we could not get you through this and that you are giving up. I do find
it odd that using =CarNo gives you acceptable result. If you want to post
your exact DLookup statement we could analyze. I have typo in my example,
[textboxcarNo] should be Me.textboxcarNo, again this is an alias (string
after the dot).
Thnks for your help June7
[quoted text clipped - 12 lines]
Less Spam Better enjoyable experience
Visit : news://spacesst.com
 
D

David

Hi
I have solved this problem By referring to the underlying sql

making the source equal the motor column 1 or 2 respectively

thanks to all who tried to help

David said:
Hi june 7
I have had a rethink and the DLookupstatement is not working

However I have fiound that by changing my car no (as you know it doesn't
bring back the corresponding Trailer Nos)

I have noticed that when I goto design view and then back to Form View and
it updates the trailer car nos.

I guess the question I am know asking is there a way I can get the form to
refresh after I change the car NO

Hopeful David

June7 via AccessMonster.com said:
Have to correct my correction. Guess trying to give advice after midnight not
great idea.
Regarding the DLookup statement: My first example is for use in textbox
ControlSource property, the second would be used in VBA code.
Sorry we could not get you through this and that you are giving up. I do find
it odd that using =CarNo gives you acceptable result. If you want to post
your exact DLookup statement we could analyze. I have typo in my example,
[textboxcarNo] should be Me.textboxcarNo, again this is an alias (string
after the dot).

Thnks for your help June7

[quoted text clipped - 12 lines]
Less Spam Better enjoyable experience
Visit : news://spacesst.com
 

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

unbound text box filter by form on Split Form 1
Unbound Combo Refresh 1
unbound forms 3
Unbound List box 3
refresh a subform 2
unbound fields on a form 1
Refresh data on form 4
Unbound combo box refresh 4

Top