Hello All,
This is my first question in this forum. I have a superform/subform design. When a value changes in the superform, a function is called which which calculate some values, and change it in every row in the subform. I am not able to figure out how to reach every row in the subform. What i need is
i = subform.rowcoun t
for count = 0 to i
subform.field.v alue = calc_value
next
any help will be appreciated
Regards
Nanda
4 9258 ADezii 8,834
Recognized Expert Expert
Hello All,
This is my first question in this forum. I have a superform/subform design. When a value changes in the superform, a function is called which which calculate some values, and change it in every row in the subform. I am not able to figure out how to reach every row in the subform. What i need is
i = subform.rowcoun t
for count = 0 to i
subform.field.v alue = calc_value
next
any help will be appreciated
Regards
Nanda
- What is the Linking Field between the Parent Form and Child Sub-Form?
- What is the Data Type of this Field?
- What value change in the Main Form will trigger Recalculations in the Sub-Form? What is this Field's Name?
Hi,
Thx for replying. here is the info you requested for
What is the Linking Field between the Parent Form and Child Sub-Form? - It is an autogenerated number called timesheetid. for each master row, there are 1-7 detail rows inthe subform, corresponding to the days of the week. the super form has a field called the week number. when the user enters this the detail form is populated with seven rows, with the first column as weekday name, (mon-sun), second column as the date (for that week, for that day) and then some other columns.
What is the Data Type of this Field? the field in question is the date field
What value change in the Main Form will trigger Recalculations in the Sub-Form? when the week number is changed in the master form, for all rows in the detail form, the date value must change.
What is this Field's Name? date
hope the above was helpful.
thanks
nanda
ADezii 8,834
Recognized Expert Expert
Hi,
Thx for replying. here is the info you requested for
What is the Linking Field between the Parent Form and Child Sub-Form? - It is an autogenerated number called timesheetid. for each master row, there are 1-7 detail rows inthe subform, corresponding to the days of the week. the super form has a field called the week number. when the user enters this the detail form is populated with seven rows, with the first column as weekday name, (mon-sun), second column as the date (for that week, for that day) and then some other columns.
What is the Data Type of this Field? the field in question is the date field
What value change in the Main Form will trigger Recalculations in the Sub-Form? when the week number is changed in the master form, for all rows in the detail form, the date value must change.
What is this Field's Name? date
hope the above was helpful.
thanks
nanda
Here is the basic Code Template. Make the necessary substitutions wherever appropriate. Be advised that you can also accomplish the above via an Update Query and a Sub-Form Requery, but I'll leave that for the SQL Gang. In the AfterUpdate() Event of [txtWeekNumber]: - Dim MyDB As DAO.Database, MyRS As DAO.Recordset, MySQL As String
-
-
MySQL = "SELECT * FROM tblChildTable WHERE [timesheetid] = " & Me![timesheetid] & ";"
-
-
If Not IsNull(Me![txtWeekNumber]) Then
-
Set MyDB = CurrentDb()
-
'Recordset for the Sub-Form
-
Set MyRS = MyDB.OpenRecordset(MySQL, dbOpenDynaset)
-
With MyRS
-
.MoveFirst
-
Do While Not .EOF
-
.Edit
-
MyRS![date] = 'whatever you are updating to. One reason why I went with
-
'code instead of SQL is that I wasn't sure how each
-
'Record would be Updated. I feel this is more flexible.
-
.Update
-
.MoveNext
-
Loop
-
End With
-
End If
-
-
'Requery the Sub-Form to see the fruits of your labor
-
Me![subfChild].Requery
hi,
Thanks for the recordset idea. The following code worked :
TimesheetDetail s.Form.Recordse t.MoveFirst
With TimesheetDetail s.Form.Recordse t
Do While Not .EOF
TimesheetDetail s!Date = getdateforweekn um(wknum, TimesheetDetail s!DayofWeek) ' this is the code that calculates the date
.MoveNext
Loop
End With
Excellent !
Best regards
Nanda
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Laura |
last post by:
Here's the situation:
I'm trying to use an update query to copy data from one row to another.
Here is the situation:
I have 5 companies that are linked to each other. I need to show all 5
companies on a form. 3 of the companies have common employees. I have a
table that looks like this:
|
by: Steven |
last post by:
OK.. Here's my situation. I have a subform on a parent form. When
the parent form is loaded, the subreport queries data from a table in
the DB. The parent form has a couple of text boxes for data entry. A
command button on the parent form inserts that data from the text boxes
into the database... The subreport is then supposed to requery and...
|
by: Kelvin |
last post by:
Dear All,
Please help.
Same as subject !!!
|
by: Kelvin |
last post by:
Hi All,
I wrote a program insert new row between rows while the datatable is
looping. It display the error message.
Exception Details: System.ArgumentException: This row already belongs
to this table.
System.Data.DataTable.InsertRow(DataRow row, Int32 proposedID,
Int32 pos) +319
System.Data.DataRowCollection.Add(DataRow row) +14
|
by: Kelvin |
last post by:
Hi All,
While the existing datatable is looping, I can insert new row into
datatable, but I can't insert it between datarows. All new rows will
inserted into buttom row.
Here is my code. Please advise!
for (i=0; i < y ; i++ )
{
| |
by: Diva |
last post by:
Hi,
I have a data grid in my application. It has 20 rows and I
have set the page size as 5. I have a Submit button on my
form and when I click on Submit, I need to loop through
the rows in the datagrid. Using the items collection just
gives me the 5 rows that are displayed on the screen.
Is there any way of looping through all the rows in...
|
by: Krij |
last post by:
Hi!
I have a problem with the following code (behind a button on
frmOrders):
(structure: frmOrders->frmOrderdetails (form with subform))
strPutBack = "INSERT INTO
tblAmountItems(ItemID,Amount,MyDate,Returned) " _
& "SELECT ItemID,Amount,MyDate,Returned " _
|
by: lucazz |
last post by:
I have a main form (not bound to any data source) with a subform based on a query. The subform shows furniture parts according to the criteria specified on the main form. The purpose of the subform is for user to enter produced quantities.
To do this I've added a quan field to the subform that is not bound to any data. The problem is that...
|
by: pdesh3 |
last post by:
I have created a form where one text box and two command buttons named Search and Clear are present. Under all these fields I am also including a subform which displays all the values stored in Patient table.
When I enter any word in the name text box and click enter then the values in sub form only display the details of the patient whose...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |