G
Guest
I have what I believe is a simple problem but have not figured it out.
I have a main form and subform. I need to restrict the number of records on
the subform to a maximum of 3. The relationship between the Main Form and
Subform is through a field called DMIID. I set an Add Record button on the
subform and need to add programing to count the number of sub-records, prior
to making the new record. If the count = 3, then a msg box to pop saying
"ALREADY AT MAX".
My initial try was:
Dim MELref, partspo, prevduedate, ExtensionCount, DMIIDnumber As String
'get previous data from current form
MELref = MELreferenceNUmber
partspo = PartsPOnumber
prevduedate = NextDueDate
DMIIDnumber = DMIID
ExtensionCount = DCount("[DMIID]", "MXExtRequest - DMI Extension data
tbl", "[DMIID] = DMIIDnumber")
I get a message error that says "you cancelled the previous operation".
What I need is, if the DMIID is "5877877", I count how many sub-records have
a DMIID of "5877877". If less than 3 then make a new record. If the count = 3
then msg box.
gavin hill
I have a main form and subform. I need to restrict the number of records on
the subform to a maximum of 3. The relationship between the Main Form and
Subform is through a field called DMIID. I set an Add Record button on the
subform and need to add programing to count the number of sub-records, prior
to making the new record. If the count = 3, then a msg box to pop saying
"ALREADY AT MAX".
My initial try was:
Dim MELref, partspo, prevduedate, ExtensionCount, DMIIDnumber As String
'get previous data from current form
MELref = MELreferenceNUmber
partspo = PartsPOnumber
prevduedate = NextDueDate
DMIIDnumber = DMIID
ExtensionCount = DCount("[DMIID]", "MXExtRequest - DMI Extension data
tbl", "[DMIID] = DMIIDnumber")
I get a message error that says "you cancelled the previous operation".
What I need is, if the DMIID is "5877877", I count how many sub-records have
a DMIID of "5877877". If less than 3 then make a new record. If the count = 3
then msg box.
gavin hill