Inconsistent Form_Open behaviour

L

.Len B

I'm all out of ideas on this so I'm hoping someone might have a

suggestion of where to look next or what to try. It's a simple

concept but long-winded to describe.



I have an Access (2003) database. Of interest are 2 forms.



The first, frmChooseChild, loads at start-up and is used to call

the second form with a chosen record displayed.

It is a continuous form and begins by showing all records.

RecordSource=Child (linked table 618 records).

DataEntry=No, OnLoad runs routines which filters the RecordSet

progressively as the user types.

I am using the technique described here.

http://allenbrowne.com/AppFindAsUType.html

Each record row finishes with cmdChoose whose Click event runs

this code

stDocName = "Debug message:" & vbCrLf & "ChildID is "

MsgBox stDocName & ChildID, vbOKOnly, "DEBUGGING"



stDocName = "frmEnterNotes"

stLinkCriteria = "ChildID = " & ChildID

DoCmd.OpenForm stDocName, , , stLinkCriteria (breakpoint)



The second, frmEnterNotes, is in single form view.

RecordSource=selqEnterNotes, selected fields from same linked

table (partial SQL below). The only reason for not using the

table is RegionID<3 and ORDER BY clause.



SELECT ChildID, FamilyNum, Surname, GivenNames, Address, _

Suburb, Postcode, other fields too.

FROM Child

WHERE (((Child.RegionID)<3))

ORDER BY Child.Surname;



The problem, It works perfectly about 50% of the time. I can't detect

a pattern or why. I filter frmChooseChild to say 5 records then click

one of the cmdChoose buttons.



The debug MsgBox always confirms the correct ChildID no matter which of

the 5 I click on.

The stLinkCriteria always looks ok (watch window) e.g. "ChildID = 641"

but sometimes the new form opens with Autonumber in the ChildID field

(normally invisible) and the other fields either blank or showing default

values. (AddNew ?) The behaviour is consistent for a given ChildID.

However, the form's Filter property is always properly set to

ChildID = nnn, even when blank and AllowFilters is always Yes.



Hints, please.
 
L

.Len B

Found it!!
The ones that failed were Regions 3 or greater.
--
Len
______________________________________________________
remove nothing for valid email address.
| I'm all out of ideas on this so I'm hoping someone might have a
|
| suggestion of where to look next or what to try. It's a simple
|
| concept but long-winded to describe.
|
|
|
| I have an Access (2003) database. Of interest are 2 forms.
|
|
|
| The first, frmChooseChild, loads at start-up and is used to call
|
| the second form with a chosen record displayed.
|
| It is a continuous form and begins by showing all records.
|
| RecordSource=Child (linked table 618 records).
|
| DataEntry=No, OnLoad runs routines which filters the RecordSet
|
| progressively as the user types.
|
| I am using the technique described here.
|
| http://allenbrowne.com/AppFindAsUType.html
|
| Each record row finishes with cmdChoose whose Click event runs
|
| this code
|
| stDocName = "Debug message:" & vbCrLf & "ChildID is "
|
| MsgBox stDocName & ChildID, vbOKOnly, "DEBUGGING"
|
|
|
| stDocName = "frmEnterNotes"
|
| stLinkCriteria = "ChildID = " & ChildID
|
| DoCmd.OpenForm stDocName, , , stLinkCriteria (breakpoint)
|
|
|
| The second, frmEnterNotes, is in single form view.
|
| RecordSource=selqEnterNotes, selected fields from same linked
|
| table (partial SQL below). The only reason for not using the
|
| table is RegionID<3 and ORDER BY clause.
|
|
|
| SELECT ChildID, FamilyNum, Surname, GivenNames, Address, _
|
| Suburb, Postcode, other fields too.
|
| FROM Child
|
| WHERE (((Child.RegionID)<3))
|
| ORDER BY Child.Surname;
|
|
|
| The problem, It works perfectly about 50% of the time. I can't detect
|
| a pattern or why. I filter frmChooseChild to say 5 records then click
|
| one of the cmdChoose buttons.
|
|
|
| The debug MsgBox always confirms the correct ChildID no matter which of
|
| the 5 I click on.
|
| The stLinkCriteria always looks ok (watch window) e.g. "ChildID = 641"
|
| but sometimes the new form opens with Autonumber in the ChildID field
|
| (normally invisible) and the other fields either blank or showing
default
|
| values. (AddNew ?) The behaviour is consistent for a given ChildID.
|
| However, the form's Filter property is always properly set to
|
| ChildID = nnn, even when blank and AllowFilters is always Yes.
|
|
|
| Hints, please.
|
|
| --
| Len
| ______________________________________________________
| remove nothing for valid email address.
|
|
 
G

Guest

.Len B said:
I'm all out of ideas on this so I'm hoping someone might have a

suggestion of where to look next or what to try. It's a simple

concept but long-winded to describe.



I have an Access (2003) database. Of interest are 2 forms.



The first, frmChooseChild, loads at start-up and is used to call

the second form with a chosen record displayed.

It is a continuous form and begins by showing all records.

RecordSource=Child (linked table 618 records).

DataEntry=No, OnLoad runs routines which filters the RecordSet

progressively as the user types.

I am using the technique described here.

http://allenbrowne.com/AppFindAsUType.html

Each record row finishes with cmdChoose whose Click event runs

this code

stDocName = "Debug message:" & vbCrLf & "ChildID is "

MsgBox stDocName & ChildID, vbOKOnly, "DEBUGGING"



stDocName = "frmEnterNotes"

stLinkCriteria = "ChildID = " & ChildID

DoCmd.OpenForm stDocName, , , stLinkCriteria (breakpoint)



The second, frmEnterNotes, is in single form view.

RecordSource=selqEnterNotes, selected fields from same linked

table (partial SQL below). The only reason for not using the

table is RegionID<3 and ORDER BY clause.



SELECT ChildID, FamilyNum, Surname, GivenNames, Address, _

Suburb, Postcode, other fields too.

FROM Child

WHERE (((Child.RegionID)<3))

ORDER BY Child.Surname;



The problem, It works perfectly about 50% of the time. I can't detect

a pattern or why. I filter frmChooseChild to say 5 records then click

one of the cmdChoose buttons.



The debug MsgBox always confirms the correct ChildID no matter which of

the 5 I click on.

The stLinkCriteria always looks ok (watch window) e.g. "ChildID = 641"

but sometimes the new form opens with Autonumber in the ChildID field

(normally invisible) and the other fields either blank or showing default

values. (AddNew ?) The behaviour is consistent for a given ChildID.

However, the form's Filter property is always properly set to

ChildID = nnn, even when blank and AllowFilters is always Yes.



Hints, please.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top