Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add Record to sub form using loop on parent form 1

Status
Not open for further replies.

act2

Technical User
Dec 17, 2005
34
US
I’m trying to use a loop on my parent form to add records to the sub form. For each week in the loop I would like to have a new record in the sub. Here is my code so far. Suggestions?

Code:
Option Compare Database
Option Explicit
Private Sub cmdEnter_Click()


Dim b As Integer
Dim x As Integer
Dim Y As Integer
Dim w As Integer
Dim th As Integer



b = Format(Me.Date1(), "ww") - Format(Me.Date2(), "ww")

Me.WeeksToBuild = wtb





x = Format(Me.Date1(), "ww")
w = Format(Me.Date2(), "ww")
th = Me.TotalHr / b
Y = b + w



For x = w To Y
  If x < Y Then
Forms.frmMain.frmsubMain.Form.WkNumber = x
[COLOR=red]I think I need a call for a new record here but i'm unable to think of how to do it[/color]
  
End If

Next x
End Sub
 
Not sure, but maybe try:
Forms.frmMain.frmsubMain.Form.RecordSet.AddNew
??



-Pete
 
Pete, Thanks that did the trick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top