By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,984 Members | 2,794 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,984 IT Pros & Developers. It's quick & easy.

Misbehaving Subform

Andrew Thackray
P: 76
Hi

Can anyone help. I have an obscure problem with an unbound sub form on my main form. Both forms are unbound as my data structure is too complex for a sinngle binding.

In the main form I have been setting the sub forms recordsource property and refreshiug it each time I want to change the records displayed. The data in the subform has an association via a secondary key to a primary table

This worked fine until I converted the data to Access 2003 format from access 2000 format Now suddenly the subform will only return records whern the SQL query asks for the set of records for the first key in the primary table. If I change the query so that is requests any onther record set I get no records returned. Yet if, in the debu window I cut and paste the subform recordsource query into an access query the query returns the right records.

The subform controls are data bound to the fields returned in the recordsource query.

The subroutine for resetting the subform is as follows. It is designed only to change the subform if records will be returned by the SQL passed to the routine

Sub ResetAllocations(ByVal SQL As String)

Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset

If SQL <> "" Then
Set conn = CurrentProject.Connection
With rs
.Open SQL, conn, adOpenDynamic
If Not .EOF And Not .BOF Then
Me.Activity_Resource_Allocations.Form.RecordSource = SQL
Me.Activity_Resource_Allocations.Form.Requery
Me.Activity_Resource_Allocations.Form.Refresh
End If
.Close
conn.Close
End With
End If
Oct 25 '06 #1
Share this Question
Share on Google+
1 Reply


Andrew Thackray
P: 76
Solved IT !!

I had master & child keys linked in the form even though it was not bound. Removing the links fixed the problem
Oct 25 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.