Controls automatic update

fahur

New member
Local time
Today, 19:42
Joined
Nov 9, 2005
Messages
8
Hi!

I have two tables:

Network_Element
NE_Data

The second one is a "child" table for Network_Element.

For these tables I've created two forms: 01_NE and 02_Data, which is a subform for 01_NE.

The procedure of data completion is this:
1. Choose Network Element
2. Open NE_Data for this element (here opens the NE_Data with a filter for this element)
3. View record or add new

The NE_Data record consists of date, number, NE_number, port_number_old, port_number_delta and port_number_new fields.

Now if I add new record, I want NE_number field to fill automaticly with a value of last record (NE_number of current Network Element).

Second "wish" :-) has to do with port_number_x fields.

After creating new record, port_number_old should be filled with port_number_new from previous record and port_number_new should be a sum of port_number_old and port_number_delta, wich user will complete.

Hope it's not very complicated :-D

Big thanks for any help...

--
fahur
 
Pat Hartman said:
I take it you are using a popup form rather than a subform.

Yes, after clicking a button a popup form appears.

In that case you need a single line of code in the popup's BeforeInsert event:

Me.[NE_Number] = Forms![01_NE]![NE_Number]

Doesn't work :-| I've put this:

Private Sub Form_BeforeInsert(Cancel As Integer)
Me.[NE_number] = Forms![01_NE]![NE_number]
End Sub


How are you defining "previous"? Tables are not flat files. One record has no relationship to another. Each time you open a recordset, the records may be in a different order. You MUST order the query by some unique identifier if you want a specific order.

Hmmm... Let me think. Every record of NE_Data has two identifiers that are most important: number (autonumbering field - I think records are ordered by this identifier) and NE_number. There's a relation between Network_Element and NE_data through NE_number. So the query could be: the record of the highest number where NE_number is X. I think this query should give "previous" record (where data are newest) for Network Element.

Thanks for reply...

--
fahur
 
Last edited:
OK. I've created a query that will work for me:

SELECT LAST(port_number_new) FROM 02_NE_Data WHERE NE_number=parameter;

It gives the value for last record of column port_number_new where Network Element number (NE_number) is parameter... (or does it??)

but how to insert this value into controls and have it parameterized (different NE_number)?

Thanks in advance...

P.S. I've put this
Me.[NE_number] = Forms![01_NE]![NE_number]
into a function and call form a button_click() event and it works... but how to do this when a new record is created??

--
fahur
 

Users who are viewing this thread

Back
Top Bottom