(Re-posting, as my original reply doesn't seem to have appeared.)
Hmm. I see some things in your posted code that lead to questions.
Is this an .mdb or .accdb with linked SQL Server tables, or is it an .adp?
Is the object pubReliabilityDBCon an ADO Connection object?
If pubReliabilityDBCon is an ADO Connection object, how did you initially
set it? Did you set it from CurrentProject.Connection or .AccessConnection,
or did you open the connection using a connection string? Please post the
code -- you can mung any credentials or sensitive information that might
appear in the connection string.
Where is this command button, "cmdAddTest", on the main form or on the
subform?
What is the name of the subform control (on the main form)?
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
What version of Access are you using, and what code are you using to add
records and refresh the form? When I use code like this in a simple test
main-form/subform arrangement, the subform's scroll bar updates
appropriately.
Private Sub cmdAddRecord_Click()
CurrentDb.Execute _
"INSERT INTO tSub (MainID, SubValue) " & _
"VALUES(" & Me.ID & ", 'foo')", _
dbFailOnError
Me.tSub.Requery
End Sub
You do have the subform's Scroll Bars property set to Both or to Vertical,
right?
Here is the code used in the form to add records to the subform.
Private Sub cmdAddTest_Click()
Dim curRecord As Integer
On Error GoTo Err_cmdAddTest_Click
curRecord = Me.CurrentRecord
'Must force a record save to ensure data integrity of the new record
DoCmd.RunCommand acCmdSaveRecord
If RTrim(Me.TestConditions.Column(1)) = "Special Test" Then
'insert new test conditions for this test from special tests
pubReliabilityDBCon.Execute ("INSERT INTO dbo.tblReliabilityTests
(ReliabilityRequestID, TestTypeID, TestConditions, NoOfSamples,
TestDuration) " & _
"VALUES (" &
Me.ReliabilityRequestID.value & "," & Me.SpecialTests.Column(4) & ","
& Me.SpecialTests.Column(0) & "," & Me.SampleNo.value & ",'" &
Me.txtDuration.value & "')")
Else
'insert new test conditions for this test from standard tests
pubReliabilityDBCon.Execute ("INSERT INTO dbo.tblReliabilityTests
(ReliabilityRequestID, TestTypeID, TestConditions, NoOfSamples,
TestDuration) " & _
"VALUES (" &
Me.ReliabilityRequestID.value & "," & Me.TestConditions.Column(4) &
"," & Me.TestConditions.Column(0) & "," & Me.SampleNo.value & ",'" &
Me.txtDuration.value & "')")
End If
Me.Requery
DoCmd.GoToRecord acDataForm, "frmReliabilityRequests", acGoTo,
curRecord
Exit Sub
Err_cmdAddTest_Click:
If Err = 91 Then
MsgBox "Re-establishing link to SQL server"
If LinkSQL Then
Resume
End If
Else
Debug.Print vbTab & "Error Occurred: " & Err.Description
Resume Next
End If
End Sub
I don't have problems with the vertical bar showing, I can even
control that myself by a count of records in the subform but for some
reason the form believes it is taller than it is because the scroll
down arrow is not visible and even if it was the scrolling bar will
not move up or down like it has room to move. I can snap some screen
shots but do now see a place to post an attachment here. If you email
me directly I can attach a screen shot or two.
Thanks.