J
JC
I have a access db that works fine in office xp and 2k3 but not 2k7.
When the button is clicked it is suppose to auto populate the custnum but
instead it popups a box asking for it when clicked in 2k7.
What could be causing it??
here is the code behind the button that fails in 2k7
here is the code behind the button in question:
Private Sub New_Customer_Button_Click()
On Error GoTo Err_New_Customer_Button_Click
DoCmd.OpenForm "AMI Inquiry Information"
DoCmd.ShowAllRecords
newnumber = DMax("[custno]", "AMICUST")
newnumber = newnumber + 1
DoCmd.GoToRecord , , A_NEWREC
Forms![AMI Inquiry Information]![current customer no] = newnumber
' [custno] = newnumber
Forms![Search by Customer].Refresh
' DoCmd.SelectObject A_FORM, "Ami Inquiry Information", False
' Dim DocName As String
' Dim LinkCriteria As String
' DocName = "AMI Inquiry Information"
' LinkCriteria = "[CUSTNO] = Forms![Search by Customer]![CUSTNO]"
' DoCmd.OpenForm DocName, , , LinkCriteria
Exit_New_Customer_Button_Click:
Exit Sub
Err_New_Customer_Button_Click:
MsgBox Error$
Resume Exit_New_Customer_Button_Click
End Sub
When the button is clicked it is suppose to auto populate the custnum but
instead it popups a box asking for it when clicked in 2k7.
What could be causing it??
here is the code behind the button that fails in 2k7
here is the code behind the button in question:
Private Sub New_Customer_Button_Click()
On Error GoTo Err_New_Customer_Button_Click
DoCmd.OpenForm "AMI Inquiry Information"
DoCmd.ShowAllRecords
newnumber = DMax("[custno]", "AMICUST")
newnumber = newnumber + 1
DoCmd.GoToRecord , , A_NEWREC
Forms![AMI Inquiry Information]![current customer no] = newnumber
' [custno] = newnumber
Forms![Search by Customer].Refresh
' DoCmd.SelectObject A_FORM, "Ami Inquiry Information", False
' Dim DocName As String
' Dim LinkCriteria As String
' DocName = "AMI Inquiry Information"
' LinkCriteria = "[CUSTNO] = Forms![Search by Customer]![CUSTNO]"
' DoCmd.OpenForm DocName, , , LinkCriteria
Exit_New_Customer_Button_Click:
Exit Sub
Err_New_Customer_Button_Click:
MsgBox Error$
Resume Exit_New_Customer_Button_Click
End Sub