I rarely use forms to manage my data so I expect this is easier than I found it (I hate it when OPs say that :D)
I have a simple table (laid out below) with lists of customers for various jobs that have to be run. The PK is a combination of the first two fields ([Job] & [CustNo]) and I will typically want to maintain the various (logically separate) lists in different sessions (I may well use the same form design but only show one job at a time).
For instance, when working on the 'ElecInv' job, I will filter to show only those records with [Job]='ElecInv'.
The form design is simply a [txtCustNo] control (linked to the [CustNo] field) on a continuous form.
Table Name=tblJobCust
My problem is that, although the form filters the existing records perfectly, when I try to add a new record (simply by entering the [CustNo] data) it complains about a missing [Job] field (ErrMsg=Index or primary key cannot contain a Null value). Clearly the [Job] field is not being set up to match the filter as I had (forlornly) hoped.
What do I need to do to add that value into the field? I'm hoping to avoid setting up invisible controls on the form. I expect I need to add the code in the Form_BeforeUpda te() event procedure, but exactly what I need to refer to I'm afraid I don't know. I also don't know which checks I may need to do to ensure this code is only run when a new entry is added and not when an existing record is amended or deleted.
I have a simple table (laid out below) with lists of customers for various jobs that have to be run. The PK is a combination of the first two fields ([Job] & [CustNo]) and I will typically want to maintain the various (logically separate) lists in different sessions (I may well use the same form design but only show one job at a time).
For instance, when working on the 'ElecInv' job, I will filter to show only those records with [Job]='ElecInv'.
The form design is simply a [txtCustNo] control (linked to the [CustNo] field) on a continuous form.
Table Name=tblJobCust
Code:
[i]Field; Type; IndexInfo[/i] Job; String; Composite PK CustNo; String; Composite PK Expiry; Date/Time 'Not necessarily required
What do I need to do to add that value into the field? I'm hoping to avoid setting up invisible controls on the form. I expect I need to add the code in the Form_BeforeUpda te() event procedure, but exactly what I need to refer to I'm afraid I don't know. I also don't know which checks I may need to do to ensure this code is only run when a new entry is added and not when an existing record is amended or deleted.
Comment