473,406 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Refreshing Main Form Field

Hello Everyone,

Access 2000

I have a main form with a continuous subform. On the main form I have a
text field called [Status]. It gets populated based on what the user
selects in a field [CommStatus] on the sub form (code in the AfterUpdate
Event). Here's the issue. If the user deletes a subform record. The
[Status] field on the main form shows null even if there is a value in the
preceding subform record. What I'd like it to do is immediately refresh to
reflect that value in the preceding record. It will show that value only if
I close the form and open it back up.

How can I do this?

Thanks for your help

William
Nov 12 '05 #1
9 3302
If the event is happening on the main form then try using Me.Refresh
otherwise Forms![frmName].Refresh

Mike Storr
www.veraccess.com
"William Wisnieski" <ww********@admissions.umass.edu> wrote in message
news:40********@news-1.oit.umass.edu...
Hello Everyone,

Access 2000

I have a main form with a continuous subform. On the main form I have a
text field called [Status]. It gets populated based on what the user
selects in a field [CommStatus] on the sub form (code in the AfterUpdate
Event). Here's the issue. If the user deletes a subform record. The
[Status] field on the main form shows null even if there is a value in the
preceding subform record. What I'd like it to do is immediately refresh to reflect that value in the preceding record. It will show that value only if I close the form and open it back up.

How can I do this?

Thanks for your help

William

Nov 12 '05 #2
Thanks Mike, but no luck.

The event is happening on the subform so I put the code both in the
AfterUpdate event of the subform and in the code of the delete button on the
subform--neither of which worked. Does it make any difference that the
field on the main form is not an unbound text box, but rather bound to a
field in the table? Would another option be to put in some code to save the
main form record after I delete a subform record? Is this what happens when
I exit and open up the form?

William
"Mike Storr" <no****@somewhere.con> wrote in message
news:Nj*********************@news20.bellglobal.com ...
If the event is happening on the main form then try using Me.Refresh
otherwise Forms![frmName].Refresh

Mike Storr
www.veraccess.com
"William Wisnieski" <ww********@admissions.umass.edu> wrote in message
news:40********@news-1.oit.umass.edu...
Hello Everyone,

Access 2000

I have a main form with a continuous subform. On the main form I have a
text field called [Status]. It gets populated based on what the user
selects in a field [CommStatus] on the sub form (code in the AfterUpdate
Event). Here's the issue. If the user deletes a subform record. The
[Status] field on the main form shows null even if there is a value in the preceding subform record. What I'd like it to do is immediately refresh to
reflect that value in the preceding record. It will show that value

only if
I close the form and open it back up.

How can I do this?

Thanks for your help

William


Nov 12 '05 #3
Which example did you use?
If it is being done from a subform, then Me.Refresh won't work. Try
Me.Parent.Refresh instead.
Using the Refresh method will only work with controls that are bound to a
recordsource of some type.
If the control in question has it's own recordsource and is not bound to a
field in the table/query that the form uses, then you will have to use
control.Requery instead.
"William Wisnieski" <ww********@admissions.umass.edu> wrote in message
news:40********@news-1.oit.umass.edu...
Thanks Mike, but no luck.

The event is happening on the subform so I put the code both in the
AfterUpdate event of the subform and in the code of the delete button on the subform--neither of which worked. Does it make any difference that the
field on the main form is not an unbound text box, but rather bound to a
field in the table? Would another option be to put in some code to save the main form record after I delete a subform record? Is this what happens when I exit and open up the form?

William
"Mike Storr" <no****@somewhere.con> wrote in message
news:Nj*********************@news20.bellglobal.com ...
If the event is happening on the main form then try using Me.Refresh
otherwise Forms![frmName].Refresh

Mike Storr
www.veraccess.com
"William Wisnieski" <ww********@admissions.umass.edu> wrote in message
news:40********@news-1.oit.umass.edu...
Hello Everyone,

Access 2000

I have a main form with a continuous subform. On the main form I have a text field called [Status]. It gets populated based on what the user
selects in a field [CommStatus] on the sub form (code in the AfterUpdate Event). Here's the issue. If the user deletes a subform record. The
[Status] field on the main form shows null even if there is a value in the preceding subform record. What I'd like it to do is immediately
refresh to
reflect that value in the preceding record. It will show that value

only
if
I close the form and open it back up.

How can I do this?

Thanks for your help

William



Nov 12 '05 #4
I used Me.Parent.Refresh in the subform. The main form control is bound to
one of the fields in the table the form uses.

"Mike Storr" <no****@somewhere.con> wrote in message
news:5i*******************@news20.bellglobal.com.. .
Which example did you use?
If it is being done from a subform, then Me.Refresh won't work. Try
Me.Parent.Refresh instead.
Using the Refresh method will only work with controls that are bound to a
recordsource of some type.
If the control in question has it's own recordsource and is not bound to a
field in the table/query that the form uses, then you will have to use
control.Requery instead.
"William Wisnieski" <ww********@admissions.umass.edu> wrote in message
news:40********@news-1.oit.umass.edu...
Thanks Mike, but no luck.

The event is happening on the subform so I put the code both in the
AfterUpdate event of the subform and in the code of the delete button on the
subform--neither of which worked. Does it make any difference that the
field on the main form is not an unbound text box, but rather bound to a
field in the table? Would another option be to put in some code to save

the
main form record after I delete a subform record? Is this what happens

when
I exit and open up the form?

William
"Mike Storr" <no****@somewhere.con> wrote in message
news:Nj*********************@news20.bellglobal.com ...
If the event is happening on the main form then try using Me.Refresh
otherwise Forms![frmName].Refresh

Mike Storr
www.veraccess.com
"William Wisnieski" <ww********@admissions.umass.edu> wrote in message
news:40********@news-1.oit.umass.edu...
> Hello Everyone,
>
> Access 2000
>
> I have a main form with a continuous subform. On the main form I have a
> text field called [Status]. It gets populated based on what the
user > selects in a field [CommStatus] on the sub form (code in the AfterUpdate > Event). Here's the issue. If the user deletes a subform record. The > [Status] field on the main form shows null even if there is a value
in the
> preceding subform record. What I'd like it to do is immediately

refresh to
> reflect that value in the preceding record. It will show that value

only
if
> I close the form and open it back up.
>
> How can I do this?
>
> Thanks for your help
>
> William
>
>



Nov 12 '05 #5
On Thu, 29 Jan 2004 15:24:49 -0500, William Wisnieski wrote:
I used Me.Parent.Refresh in the subform. The main form control is bound to
one of the fields in the table the form uses.

"Mike Storr" <no****@somewhere.con> wrote in message
news:5i*******************@news20.bellglobal.com.. .

I re-read your original posting and I beleive that I misunderstood it at
first. However, I'm having some trouble envisioning the way you have things
setup, so some more info about how the forms are linked to each other, and
perhaps a brief example of the table/query you are using to do this would
help?

--
Mike Storr
veraccess.com
Nov 12 '05 #6
William Wisnieski wrote:
Hello Everyone,

Access 2000

I have a main form with a continuous subform. On the main form I have a
text field called [Status]. It gets populated based on what the user
selects in a field [CommStatus] on the sub form (code in the AfterUpdate
Event). Here's the issue. If the user deletes a subform record. The
[Status] field on the main form shows null even if there is a value in the
preceding subform record. What I'd like it to do is immediately refresh to
reflect that value in the preceding record. It will show that value only if
I close the form and open it back up.

How can I do this?

Thanks for your help

William


Check out the GoToRecord, as in, Docmd.GotoRecord acPrevious. You would not
want to do that if you are on the first record so you'd need to check...see the
AbsolutePosition property. You would want to grab the value of the status in
the previous record in one off the OnDelete events.
Nov 12 '05 #7
Thanks Mike

Here's a more thorough explanation. I posted it under another thread based
on another approach someone told me.

I have a query by form that returns a record set in a datasheet. The user
double clicks on a row and a main form (pop up) opens bound to a table with
a continuous subform bound to another table.

On the main form is a field called [Status]. It is vital that this is
always populated with the value from a field [CommStatus] in the most recent
record on the subform. The subform table has a primary key [CommID] as well
as a date/time stamp field. Because a user can delete subform records and
add to them, I need that main form field [Status] to always have the value
from the most recent subform record, which means the highest CommID or most
recent date and time. The users move frequently from next record to
previous record of the recordset while on the main form, adding and deleting
subform records.

I've tried code in the OnCurrent event of the main form to get the value.
This works if I close the form and reopen it because the subform is set to
go to the last record . But if the user clicks next record, then goes back
it doesn't update. I've tried setting the OnCurrent event of the subform to
go to the last record but this seems to freeze the new record area of the
subform. I've tried using refresh in the after update event of the subform
and that didn't work either.

I'm playing around with using a DMax statement in an unbound text box on the
subform to return the highest CommID then somehow refer to it in the
OnCurrent event of the main form...but I'm still open to all suggestions!

William

"Mike Storr" <st******@sympatico.ca> wrote in message
news:w8**************************@40tude.net...
On Thu, 29 Jan 2004 15:24:49 -0500, William Wisnieski wrote:
I used Me.Parent.Refresh in the subform. The main form control is bound to one of the fields in the table the form uses.

"Mike Storr" <no****@somewhere.con> wrote in message
news:5i*******************@news20.bellglobal.com.. .

I re-read your original posting and I beleive that I misunderstood it at
first. However, I'm having some trouble envisioning the way you have

things setup, so some more info about how the forms are linked to each other, and
perhaps a brief example of the table/query you are using to do this would
help?

--
Mike Storr
veraccess.com

Nov 12 '05 #8
If the [Status] field is not editable, have you tried giving it a
ControlSource of Forms.MainForm.SubformControlName.Form!CommStatus.
If it is editable, then is the mainform and subform linked using
master/child linking or some other method?

Mike Storr
www.veraccess.com
"William Wisnieski" <ww********@admissions.umass.edu> wrote in message
news:40********@news-1.oit.umass.edu...
Thanks Mike

Here's a more thorough explanation. I posted it under another thread based on another approach someone told me.

I have a query by form that returns a record set in a datasheet. The user
double clicks on a row and a main form (pop up) opens bound to a table with a continuous subform bound to another table.

On the main form is a field called [Status]. It is vital that this is
always populated with the value from a field [CommStatus] in the most recent record on the subform. The subform table has a primary key [CommID] as well as a date/time stamp field. Because a user can delete subform records and
add to them, I need that main form field [Status] to always have the value
from the most recent subform record, which means the highest CommID or most recent date and time. The users move frequently from next record to
previous record of the recordset while on the main form, adding and deleting subform records.

I've tried code in the OnCurrent event of the main form to get the value.
This works if I close the form and reopen it because the subform is set to
go to the last record . But if the user clicks next record, then goes back it doesn't update. I've tried setting the OnCurrent event of the subform to go to the last record but this seems to freeze the new record area of the
subform. I've tried using refresh in the after update event of the subform and that didn't work either.

I'm playing around with using a DMax statement in an unbound text box on the subform to return the highest CommID then somehow refer to it in the
OnCurrent event of the main form...but I'm still open to all suggestions!

William

"Mike Storr" <st******@sympatico.ca> wrote in message
news:w8**************************@40tude.net...
On Thu, 29 Jan 2004 15:24:49 -0500, William Wisnieski wrote:
I used Me.Parent.Refresh in the subform. The main form control is
bound
to one of the fields in the table the form uses.

"Mike Storr" <no****@somewhere.con> wrote in message
news:5i*******************@news20.bellglobal.com.. .

I re-read your original posting and I beleive that I misunderstood it at
first. However, I'm having some trouble envisioning the way you have

things
setup, so some more info about how the forms are linked to each other, and perhaps a brief example of the table/query you are using to do this would help?

--
Mike Storr
veraccess.com


Nov 12 '05 #9
Here's the solution that seems to finally be working:

In the OnCurrent Event of the Main Form I have this code:

Private Sub Form_Current()
Dim rs As Recordset
Set rs = Me![sfrmCommunication].Form.RecordsetClone
If rs.RecordCount > 0 Then
rs.MoveLast
Me![sfrmCommunication].Form.Bookmark = rs.Bookmark
Set rs = Nothing
Else
rs.AddNew
End If
Me.Status = [Forms]![frmStudentRecord]![sfrmCommunication]!CommStatus
End Sub

So far so good....

William

"Mike Storr" <no****@somewhere.con> wrote in message
news:95*********************@news20.bellglobal.com ...
If the [Status] field is not editable, have you tried giving it a
ControlSource of Forms.MainForm.SubformControlName.Form!CommStatus.
If it is editable, then is the mainform and subform linked using
master/child linking or some other method?

Mike Storr
www.veraccess.com
"William Wisnieski" <ww********@admissions.umass.edu> wrote in message
news:40********@news-1.oit.umass.edu...
Thanks Mike

Here's a more thorough explanation. I posted it under another thread based
on another approach someone told me.

I have a query by form that returns a record set in a datasheet. The user
double clicks on a row and a main form (pop up) opens bound to a table

with
a continuous subform bound to another table.

On the main form is a field called [Status]. It is vital that this is
always populated with the value from a field [CommStatus] in the most

recent
record on the subform. The subform table has a primary key [CommID] as

well
as a date/time stamp field. Because a user can delete subform records and add to them, I need that main form field [Status] to always have the value from the most recent subform record, which means the highest CommID or

most
recent date and time. The users move frequently from next record to
previous record of the recordset while on the main form, adding and

deleting
subform records.

I've tried code in the OnCurrent event of the main form to get the value. This works if I close the form and reopen it because the subform is set to go to the last record . But if the user clicks next record, then goes

back
it doesn't update. I've tried setting the OnCurrent event of the subform to
go to the last record but this seems to freeze the new record area of

the subform. I've tried using refresh in the after update event of the

subform
and that didn't work either.

I'm playing around with using a DMax statement in an unbound text box on

the
subform to return the highest CommID then somehow refer to it in the
OnCurrent event of the main form...but I'm still open to all suggestions!
William

"Mike Storr" <st******@sympatico.ca> wrote in message
news:w8**************************@40tude.net...
On Thu, 29 Jan 2004 15:24:49 -0500, William Wisnieski wrote:

> I used Me.Parent.Refresh in the subform. The main form control is

bound
to
> one of the fields in the table the form uses.
>
> "Mike Storr" <no****@somewhere.con> wrote in message
> news:5i*******************@news20.bellglobal.com.. .
I re-read your original posting and I beleive that I misunderstood it at first. However, I'm having some trouble envisioning the way you have

things
setup, so some more info about how the forms are linked to each other,

and perhaps a brief example of the table/query you are using to do this would help?

--
Mike Storr
veraccess.com



Nov 12 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: LRD | last post by:
Form not refreshing after autopostback unless keyboard or mouse move Hi, We created several new ASP.NET C# forms for our intranet. In each form we use panels for different sections of the...
1
by: MaXXXiMaNiAc | last post by:
Hey all, I have attached here a sample of what im trying to do. Basically i set up a combo box in a subform where an employee will select his name. I want the selection to be made only once...
3
by: G25532 | last post by:
I have a form that contains a macro button which on clicking, opens a subform over the main form. I have in the macro "Where Condition" the following: =!! The subform has related fields as...
8
by: Daniel P. | last post by:
I'm trying to set a timer that gets called every 3 seconds so I can update a field in the UI with the time elapsed since the process started. What am I doing wrong that timerDF_Tick does not get...
3
by: gsb58 | last post by:
Hi! A mainform is being used to show records from a table in an sql database. A button on the main form will load a new form that allows the user to add, delete, update and search certain...
2
by: dmartin_1 | last post by:
I'm building an application with Visual Basic 2005. The application is multi threaded. It has a record counter on the form that counts up to completion. It works fine throughout the process as...
1
by: Iain | last post by:
I am attempting to create an "easy input (from the pov of the user)" form. A main form displays one page per record with a sub form displaying a list of records related to the main record. The...
0
by: sean.hpr | last post by:
Hi all- I am a vb2005 newb so apologies in advance. Essentially I am having some problems with data refreshing on some of my forms. Background: I have created a project containing a few...
6
by: 130975 | last post by:
Hi Everybody, I am working on a database that creates the Student Code and their email id's. Table Student stores basic information like First name, last name, address, class etc. Table Email...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.