Be aware that "Type" (in tblCUSTMAST) and "Date" (in tblINVDET and tblINVHDR) are reserved words and shouldn't be used as object names> Plus, they are not very descriptive.... "Type" of what??? "Date" of what????
In the code, you have lines like
Code:
If DCount("INV_NUM", "tblINVHDR", "nz([INV_NUM]) = '" & [Forms]![frmINVOICESELECTION]![Text12] & "'") <> 0 Then
MsgBox "INVNUM: YES"
Else: MsgBox "INVNUM: NO"
End If
The colon (after ELSE) was used in IBM Basic as a command separator (Memory was VERY expensive - this helped conserve memory useage). Its use has been depreciated. It still works - backward compatibility - but you should NOT use the colon in code nowadays.
Better is
Code:
If DCount("INV_NUM", "tblINVHDR", "nz([INV_NUM]) = '" & [Forms]![frmINVOICESELECTION]![Text12] & "'") <> 0 Then
MsgBox "INVNUM: YES"
Else
MsgBox "INVNUM: NO"
End If
You could use
Code:
Private Sub Form_Load()
If Not IsNull(Me.OpenArgs) Then
DoCmd.Close acForm, "frmCUSTMASTLIST", acSaveNo: Me.Text2 = Me.OpenArgs: Me!Text12.SetFocus
End If
End Sub
but how hard it that to read/edit????
You have this line in several places:
Code:
DoCmd.Close acForm, "frmINVOICESELECTION", acSaveNo
The argument "acSaveNo" is for saving DESIGN changes, not data entries. So, unless your code is opening the form in design view, "acSaveNo" has no effect - the data will still be saved.
Also, in EVERY code module, the first two lines should be
Code:
Option Compare Database
Option Explicit
In the IDE, there is a check box, "Require Variable Declaration", that should be checked (TOOLS/OPTIONS/Editor tab)
After the check box is checked, in any NEW module, "Option Explicit" will be added automatically.
I'd also like to know how to resize that [censored] SubForm in frmINVOICEENTRY
In both "sfrmINVOICEENTRY2" and the subform control in "frmINVOICEENTRY", the form footer height is 0, but the form footer section is about 3 inches long.
Move the bottom of the form (where the scroll bar is) up to the bottom of the detail section (where it says "Form Footer" and save the form.
Ta-Da!!!