Hi everyone 
I have a macro which looks at the primary key (this being 'CustRef') in the current form and opens up the 'Finance' form retrieving the same 'CustRef' record.
Here is my macro:
Private Sub Finance_Click()
On Error GoTo Err_OpenFinance_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Finance"
stLinkCriteria = "[CustRef]=" & Me![CustRef]
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Maximize
Exit_OpenFinance_Click:
Exit Sub
Err_OpenFinance_Click:
MsgBox Err.Description
Resume Exit_OpenFinance_Click
End Sub
This is great if the record already exists in the 'Finance' table/form, but when the record does not exist, the database just gives a blank 'CustRef' field.
I need the 'CustRef' field in the Finance form to automatically populate with the 'CustRef' number even though the record does not exist.
This would be so that the record could be created without having to rely on people selecting the correct customer number.
Thanks in advance for you help

I have a macro which looks at the primary key (this being 'CustRef') in the current form and opens up the 'Finance' form retrieving the same 'CustRef' record.
Here is my macro:
Private Sub Finance_Click()
On Error GoTo Err_OpenFinance_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Finance"
stLinkCriteria = "[CustRef]=" & Me![CustRef]
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Maximize
Exit_OpenFinance_Click:
Exit Sub
Err_OpenFinance_Click:
MsgBox Err.Description
Resume Exit_OpenFinance_Click
End Sub
This is great if the record already exists in the 'Finance' table/form, but when the record does not exist, the database just gives a blank 'CustRef' field.
I need the 'CustRef' field in the Finance form to automatically populate with the 'CustRef' number even though the record does not exist.
This would be so that the record could be created without having to rely on people selecting the correct customer number.
Thanks in advance for you help
