S
Seren
I have two forms. One calls the other with a command button. I am trying to
get it so that, when the 2nd form is opened, it is opened with a specific #
of records already created and ready to be *updated*. there is a field on
the first form that requests the number of layers for a job. That's how many
times it should loop through the for... next loop. I have an input box in
place that shows me it's grabbing the information from the forms, but the 2nd
form is coming up with no records.
This is on the 2nd form:
Function Layer()
Dim stDup
Dim JNum
JNum = Form_Form3.JobID.Value
stDup = "JobID = " & "'" & JNum & "'"
' If DCount("JobID", "tblLayer", stDup) > 0 Then
Dim strSQL
Dim strSql2
Dim stDocName As String
stDocName = "frmLayer"
strSQL = "SELECT LayerID, cboLayerType, txtLayerNum, txtBrdWShort,
txtShortDetected, " & _
"txtQtyRepaired, txtBrdWOpen, txtOpensDetected, ckScrapCore,jobid " & _
"FROM tblLayer WHERE JobID = " & Form_Form3.JobID & ";"
strSql2 = "SELECT cboLayerType FROM tblLayer WHERE jobid = " &
Form_Form3.JobID
DoCmd.OpenForm stDocName
InputBox strSQL, strSQL, strSQL
Form_frmLayer.Form.RecordSource = strSQL
Form_frmLayer.Form.Requery
End Function
Private Sub Form_Load()
Layer
Dim rowCount As Integer
Dim strSQL As String
rowCount = Form_Form3.txtLayers
For x = 1 To rowCount
strSQL = "INSERT INTO tblLayer (JobID, cboLayerType, txtLayerNum) " & _
"VALUES (" & Form_Form3.JobID & ", " & Form_Form3.cboLayerType & _
", " & rowCount & ");"
InputBox strSQL, strSQL, strSQL
Next x
End Sub
Any suggestions as to why this is occuring and how to fix it?
Thanks
Seren
get it so that, when the 2nd form is opened, it is opened with a specific #
of records already created and ready to be *updated*. there is a field on
the first form that requests the number of layers for a job. That's how many
times it should loop through the for... next loop. I have an input box in
place that shows me it's grabbing the information from the forms, but the 2nd
form is coming up with no records.
This is on the 2nd form:
Function Layer()
Dim stDup
Dim JNum
JNum = Form_Form3.JobID.Value
stDup = "JobID = " & "'" & JNum & "'"
' If DCount("JobID", "tblLayer", stDup) > 0 Then
Dim strSQL
Dim strSql2
Dim stDocName As String
stDocName = "frmLayer"
strSQL = "SELECT LayerID, cboLayerType, txtLayerNum, txtBrdWShort,
txtShortDetected, " & _
"txtQtyRepaired, txtBrdWOpen, txtOpensDetected, ckScrapCore,jobid " & _
"FROM tblLayer WHERE JobID = " & Form_Form3.JobID & ";"
strSql2 = "SELECT cboLayerType FROM tblLayer WHERE jobid = " &
Form_Form3.JobID
DoCmd.OpenForm stDocName
InputBox strSQL, strSQL, strSQL
Form_frmLayer.Form.RecordSource = strSQL
Form_frmLayer.Form.Requery
End Function
Private Sub Form_Load()
Layer
Dim rowCount As Integer
Dim strSQL As String
rowCount = Form_Form3.txtLayers
For x = 1 To rowCount
strSQL = "INSERT INTO tblLayer (JobID, cboLayerType, txtLayerNum) " & _
"VALUES (" & Form_Form3.JobID & ", " & Form_Form3.cboLayerType & _
", " & rowCount & ");"
InputBox strSQL, strSQL, strSQL
Next x
End Sub
Any suggestions as to why this is occuring and how to fix it?
Thanks
Seren