Confused about event sequence in new row

R

Richard

How can I set and display an initial value in _Current when
NewRecord ?

Two tables
Specs:
SpecId, rev, name, date
SpecElements:
SpecId, element, min, max, displayindex
Elements:
element

Each specid can have min/max values for any of the elements in
Elements.

SpecElements might look like
1,Ni,null,1.5,1
1,Mo,2,2.5,2
2,Ni,1.5,2.2,1
2,Cr,2.1,2.6,2
2,Mo,3,3.5,3

I have a form and subform linked by [SpecId]

The sub form is continuous and displays
[element] [elementpicker_combo] [displayindex]
The header has
[SpecId] for debugggin purposes, and would normally be set non-
visible
[MaxDisplayIndex] = Max([DisplayIndex]), also to be invisible.

The elementpicker_combo is a based on a view qryRemainingElements,
that in turn uses ![SpecId]
The query ensures an element will not appear twice for a given specid.
-----
SELECT Element, DisplayIndex
FROM tblElements
WHERE Element
NOT IN
( select Element
from tblSpecificationElements
where SpecificationID = ![SpecificationID]
)

UNION SELECT Element, 0 as DisplayIndex
FROM tblElements
WHERE Element = ![Element]
ORDER BY DisplayIndex;
-----


Since the query depends on element and spec, I have a form_current
with
Private Sub Form_Current()
MyElementPicker.Requery
End Sub

When the user selects from the picker, the value is transferred
Private Sub MyElementPicker_Change()
Element = MyElementPicker
Refresh
End Sub

The problem occurs in NewRecord.

Rec 1 - showing data
....
Rec New - for data entry
Rec * - for next new data entry

If the user types in min or max the very first thing, the * new
record appears below the data entry row.
However, if the user selects via drop down, the * new record does
not appear below the data entry row. If the new is the first record
of the subform, there are no scroll bars. If new records is >1st
record in subform, using scrollbars will make the "* new record row"
appear.

How can I make the first action of a new row (the unbound combobox
selection) force access to do its 'insert has occurred' recognition,
at which point I think it goes off and does afterinsert.
 
R

ruralguy via AccessMonster.com

I didn't follow all of what you said but if you go into the Access Help
system, not the VBA Help system, and ask the Answer Wizard for EVENTS, there
is a pretty good description of all of the events and when they occur.
How can I set and display an initial value in _Current when
NewRecord ?

Two tables
Specs:
SpecId, rev, name, date
SpecElements:
SpecId, element, min, max, displayindex
Elements:
element

Each specid can have min/max values for any of the elements in
Elements.

SpecElements might look like
1,Ni,null,1.5,1
1,Mo,2,2.5,2
2,Ni,1.5,2.2,1
2,Cr,2.1,2.6,2
2,Mo,3,3.5,3

I have a form and subform linked by [SpecId]

The sub form is continuous and displays
[element] [elementpicker_combo] [displayindex]
The header has
[SpecId] for debugggin purposes, and would normally be set non-
visible
[MaxDisplayIndex] = Max([DisplayIndex]), also to be invisible.

The elementpicker_combo is a based on a view qryRemainingElements,
that in turn uses ![SpecId]
The query ensures an element will not appear twice for a given specid.
-----
SELECT Element, DisplayIndex
FROM tblElements
WHERE Element
NOT IN
( select Element
from tblSpecificationElements
where SpecificationID = ![SpecificationID]
)

UNION SELECT Element, 0 as DisplayIndex
FROM tblElements
WHERE Element = ![Element]
ORDER BY DisplayIndex;
-----

Since the query depends on element and spec, I have a form_current
with
Private Sub Form_Current()
MyElementPicker.Requery
End Sub

When the user selects from the picker, the value is transferred
Private Sub MyElementPicker_Change()
Element = MyElementPicker
Refresh
End Sub

The problem occurs in NewRecord.

Rec 1 - showing data
...
Rec New - for data entry
Rec * - for next new data entry

If the user types in min or max the very first thing, the * new
record appears below the data entry row.
However, if the user selects via drop down, the * new record does
not appear below the data entry row. If the new is the first record
of the subform, there are no scroll bars. If new records is >1st
record in subform, using scrollbars will make the "* new record row"
appear.

How can I make the first action of a new row (the unbound combobox
selection) force access to do its 'insert has occurred' recognition,
at which point I think it goes off and does afterinsert.
 

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