A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Refreshing subdata form



 
 
Thread Tools Display Modes
  #1  
Old October 16th, 2006, 09:16 PM posted to microsoft.public.access.tablesdbdesign
Robert Robinson
external usenet poster
 
Posts: 22
Default Refreshing subdata form

I have created a form which has a main sheet (with lease header information)
and a subform (which has lease detail information). I have established the
necessary one-to-many relationship between the header and the detail. The
detail will often consist of 50+ lines, so I created a macro which updates
the detail table directly. The macro works perfectly; the problem is with the
subform. The subform does not display the lines that have been added to the
base table. From what I can see, the subform perform a query to set up the
fields allowing user entry; however, it does not refresh when data is entered
into the table by means other than entry through the form (subform). Is my
understanding correct? If so (or not), what is the most efficient way to
refresh the subform so that it reflects the imported data?
--
Robert Robinson
  #2  
Old October 17th, 2006, 04:05 PM posted to microsoft.public.access.tablesdbdesign
kingston via AccessMonster.com
external usenet poster
 
Posts: 620
Default Refreshing subdata form

Use the VBA command:
Me.subform_control_name.Requery
Hopefully, the data import is done via your form so there is an event trigger
that you can use.

Robert Robinson wrote:
I have created a form which has a main sheet (with lease header information)
and a subform (which has lease detail information). I have established the
necessary one-to-many relationship between the header and the detail. The
detail will often consist of 50+ lines, so I created a macro which updates
the detail table directly. The macro works perfectly; the problem is with the
subform. The subform does not display the lines that have been added to the
base table. From what I can see, the subform perform a query to set up the
fields allowing user entry; however, it does not refresh when data is entered
into the table by means other than entry through the form (subform). Is my
understanding correct? If so (or not), what is the most efficient way to
refresh the subform so that it reflects the imported data?


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...esign/200610/1

  #3  
Old October 17th, 2006, 04:20 PM posted to microsoft.public.access.tablesdbdesign
Robert Robinson
external usenet poster
 
Posts: 22
Default Refreshing subdata form

Yes there is. I can add that code to my upload. Thanks.
--
Robert Robinson


"kingston via AccessMonster.com" wrote:

Use the VBA command:
Me.subform_control_name.Requery
Hopefully, the data import is done via your form so there is an event trigger
that you can use.

Robert Robinson wrote:
I have created a form which has a main sheet (with lease header information)
and a subform (which has lease detail information). I have established the
necessary one-to-many relationship between the header and the detail. The
detail will often consist of 50+ lines, so I created a macro which updates
the detail table directly. The macro works perfectly; the problem is with the
subform. The subform does not display the lines that have been added to the
base table. From what I can see, the subform perform a query to set up the
fields allowing user entry; however, it does not refresh when data is entered
into the table by means other than entry through the form (subform). Is my
understanding correct? If so (or not), what is the most efficient way to
refresh the subform so that it reflects the imported data?


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...esign/200610/1


  #4  
Old October 17th, 2006, 08:21 PM posted to microsoft.public.access.tablesdbdesign
Robert Robinson
external usenet poster
 
Posts: 22
Default Refreshing subdata form

Kingston -

Here is my VBA code for the combination upload/refresh:

Private Sub Import_Lease_Detail_Click()
On Error GoTo Err_Import_Lease_Detail_Click
Dim stDocName As String
stDocName = "Lease Detail upload"
DoCmd.RunMacro stDocName
Me.Agreement_Detail_subform.Requery
Exit_Import_Lease_Detail_Click:
Exit Sub
Err_Import_Lease_Detail_Click:
MsgBox Err.Description
Resume Exit_Import_Lease_Detail_Click
End Sub

The lease detail uploads, but the subform does not requery. Not sure what I
am missing...

--
Robert Robinson


"kingston via AccessMonster.com" wrote:

Use the VBA command:
Me.subform_control_name.Requery
Hopefully, the data import is done via your form so there is an event trigger
that you can use.

Robert Robinson wrote:
I have created a form which has a main sheet (with lease header information)
and a subform (which has lease detail information). I have established the
necessary one-to-many relationship between the header and the detail. The
detail will often consist of 50+ lines, so I created a macro which updates
the detail table directly. The macro works perfectly; the problem is with the
subform. The subform does not display the lines that have been added to the
base table. From what I can see, the subform perform a query to set up the
fields allowing user entry; however, it does not refresh when data is entered
into the table by means other than entry through the form (subform). Is my
understanding correct? If so (or not), what is the most efficient way to
refresh the subform so that it reflects the imported data?


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...esign/200610/1


  #5  
Old October 18th, 2006, 02:33 PM posted to microsoft.public.access.tablesdbdesign
kingston via AccessMonster.com
external usenet poster
 
Posts: 620
Default Refreshing subdata form

I don't see anything wrong with your code. Does it give you any error
messages? If it doesn't then the requery command is executing and just not
working like you think it should because of the way your forms and data are
tied together. Make sure the subform control name is
"Agreement_Detail_subform"; this is not necessarily the same as the subform
name. In design view of the main form, look for the subform control's name.
When you type "Me." while coding, does the name of the subform control
automatically appear? Is the subform bound to the data table or query that
you want to refresh (check the subform's record source)? Are there any
filters turned on? They conflict with subforms. Also, double-check your
macro by running it and then opening the subform independently of the main
form. Do the correct records appear then?

Robert Robinson wrote:
Kingston -

Here is my VBA code for the combination upload/refresh:

Private Sub Import_Lease_Detail_Click()
On Error GoTo Err_Import_Lease_Detail_Click
Dim stDocName As String
stDocName = "Lease Detail upload"
DoCmd.RunMacro stDocName
Me.Agreement_Detail_subform.Requery
Exit_Import_Lease_Detail_Click:
Exit Sub
Err_Import_Lease_Detail_Click:
MsgBox Err.Description
Resume Exit_Import_Lease_Detail_Click
End Sub

The lease detail uploads, but the subform does not requery. Not sure what I
am missing...

Use the VBA command:
Me.subform_control_name.Requery

[quoted text clipped - 12 lines]
understanding correct? If so (or not), what is the most efficient way to
refresh the subform so that it reflects the imported data?


--
Message posted via http://www.accessmonster.com

  #6  
Old October 18th, 2006, 02:52 PM posted to microsoft.public.access.tablesdbdesign
Robert Robinson
external usenet poster
 
Posts: 22
Default Refreshing subdata form

Not an error message.

When I start the VBA code "Me.", yes, "Agreement_Detail_Subform" does appear
(a handy little tool).

There are no filters.

This is the darnedest thing; by all rights, this bloody bit of code should
work. I even created a general "Requery" Macro, and ran it in the form with
no errors, but no results...
--
Robert Robinson


"kingston via AccessMonster.com" wrote:

I don't see anything wrong with your code. Does it give you any error
messages? If it doesn't then the requery command is executing and just not
working like you think it should because of the way your forms and data are
tied together. Make sure the subform control name is
"Agreement_Detail_subform"; this is not necessarily the same as the subform
name. In design view of the main form, look for the subform control's name.
When you type "Me." while coding, does the name of the subform control
automatically appear? Is the subform bound to the data table or query that
you want to refresh (check the subform's record source)? Are there any
filters turned on? They conflict with subforms. Also, double-check your
macro by running it and then opening the subform independently of the main
form. Do the correct records appear then?

Robert Robinson wrote:
Kingston -

Here is my VBA code for the combination upload/refresh:

Private Sub Import_Lease_Detail_Click()
On Error GoTo Err_Import_Lease_Detail_Click
Dim stDocName As String
stDocName = "Lease Detail upload"
DoCmd.RunMacro stDocName
Me.Agreement_Detail_subform.Requery
Exit_Import_Lease_Detail_Click:
Exit Sub
Err_Import_Lease_Detail_Click:
MsgBox Err.Description
Resume Exit_Import_Lease_Detail_Click
End Sub

The lease detail uploads, but the subform does not requery. Not sure what I
am missing...

Use the VBA command:
Me.subform_control_name.Requery

[quoted text clipped - 12 lines]
understanding correct? If so (or not), what is the most efficient way to
refresh the subform so that it reflects the imported data?


--
Message posted via http://www.accessmonster.com


  #7  
Old October 18th, 2006, 03:10 PM posted to microsoft.public.access.tablesdbdesign
kingston via AccessMonster.com
external usenet poster
 
Posts: 620
Default Refreshing subdata form

Try this:

Me.Agreement_Detail_subform.Form.Requery

Robert Robinson wrote:
Not an error message.

When I start the VBA code "Me.", yes, "Agreement_Detail_Subform" does appear
(a handy little tool).

There are no filters.

This is the darnedest thing; by all rights, this bloody bit of code should
work. I even created a general "Requery" Macro, and ran it in the form with
no errors, but no results...
I don't see anything wrong with your code. Does it give you any error
messages? If it doesn't then the requery command is executing and just not

[quoted text clipped - 34 lines]
understanding correct? If so (or not), what is the most efficient way to
refresh the subform so that it reflects the imported data?


--
Message posted via http://www.accessmonster.com

  #8  
Old October 18th, 2006, 04:26 PM posted to microsoft.public.access.tablesdbdesign
Robert Robinson
external usenet poster
 
Posts: 22
Default Refreshing subdata form

Tried it. Populates the table fine, does not update the subform, no errors
found.

Am checking the subform to see if anything would prevent updates...
--
Robert Robinson


"kingston via AccessMonster.com" wrote:

Try this:

Me.Agreement_Detail_subform.Form.Requery

Robert Robinson wrote:
Not an error message.

When I start the VBA code "Me.", yes, "Agreement_Detail_Subform" does appear
(a handy little tool).

There are no filters.

This is the darnedest thing; by all rights, this bloody bit of code should
work. I even created a general "Requery" Macro, and ran it in the form with
no errors, but no results...
I don't see anything wrong with your code. Does it give you any error
messages? If it doesn't then the requery command is executing and just not

[quoted text clipped - 34 lines]
understanding correct? If so (or not), what is the most efficient way to
refresh the subform so that it reflects the imported data?


--
Message posted via http://www.accessmonster.com


  #9  
Old October 18th, 2006, 04:42 PM posted to microsoft.public.access.tablesdbdesign
kingston via AccessMonster.com
external usenet poster
 
Posts: 620
Default Refreshing subdata form

Perhaps the subform and main form already have a parent-child link
established? If so, clear the Link Child Fields and Link Master Fields
properties in the subform control. What data is the subform bound to? Is it
a table or a query? Either way, make sure the table or query displays the
correct data after your import macro. Open the subform by itself to check
this.

Robert Robinson wrote:
Tried it. Populates the table fine, does not update the subform, no errors
found.

Am checking the subform to see if anything would prevent updates...
Try this:

[quoted text clipped - 15 lines]
understanding correct? If so (or not), what is the most efficient way to
refresh the subform so that it reflects the imported data?


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...esign/200610/1

  #10  
Old October 18th, 2006, 06:21 PM posted to microsoft.public.access.tablesdbdesign
Robert Robinson
external usenet poster
 
Posts: 22
Default Refreshing subdata form

You are correct, sir.

I have 3 fields linked parent to child. I think you have identified a design
flaw. I duplicated the 3 fields to mimic an ERP program (for user
comfortability), but it looks like this design prevents the refresh of data
after the upload. As soon as I removed the parent/child link, the refresh
took place automatically. Thanks for your help.
--
Robert Robinson


"kingston via AccessMonster.com" wrote:

Perhaps the subform and main form already have a parent-child link
established? If so, clear the Link Child Fields and Link Master Fields
properties in the subform control. What data is the subform bound to? Is it
a table or a query? Either way, make sure the table or query displays the
correct data after your import macro. Open the subform by itself to check
this.

Robert Robinson wrote:
Tried it. Populates the table fine, does not update the subform, no errors
found.

Am checking the subform to see if anything would prevent updates...
Try this:

[quoted text clipped - 15 lines]
understanding correct? If so (or not), what is the most efficient way to
refresh the subform so that it reflects the imported data?


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...esign/200610/1


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:09 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.