Not all fields blank after going to new record

blacktide

Registered User.
Local time
Today, 00:24
Joined
Oct 10, 2003
Messages
31
I have a form set to be blank when opening it using:

Private Sub Form_Load()
DoCmd.GoToRecord , , acNewRec
CUSTOMER.SetFocus
End Sub

This works great.

I also have it set were the last tab stop is a command button that does two things A) it prints the form and B) it brings up a new record using:

Private Sub Print_Record_Click()
On Error GoTo Err_Print_Record_Click


DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection
DoCmd.RunCommand acCmdRecordsGoToNew

Exit_Print_Record_Click:
Exit Sub

Err_Print_Record_Click:
MsgBox Err.Description
Resume Exit_Print_Record_Click

End Sub

This should bring up a new blank record, but it leaves two combo boxes filled in. These two combo boxes are unbound and come from two different tables A)Customer_Invoice_Addresses and B) Customer_Ship_to_Addresses.




Is there something that I can add to my Print Record code or should I do something in the combo boxex?



Mike
 
Unbound controls are not tied to particular records, and so will not change their values as you go from record-to-record.

If you want to reset their values, use some code of this form:
Me.MyComboBox=Null
Or
Me.MyComboBox=""

You should be able to add that to the end of your print code.
 
Works as advertised. Thank you very much!!!!!

Here is exactly how I used it:
Private Sub Print_Record_Click()
On Error GoTo Err_Print_Record_Click


DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection
DoCmd.RunCommand acCmdRecordsGoToNew
Me.CUSTOMER_INVOICE_ADDRESS = ""
Me.SHIP_TO_ADDRESS = ""

Exit_Print_Record_Click:
Exit Sub

Err_Print_Record_Click:
MsgBox Err.Description
Resume Exit_Print_Record_Click

End Sub

Mike
 

Users who are viewing this thread

Back
Top Bottom