Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command Button Open New/Blank Record

Status
Not open for further replies.

webvine

Technical User
Oct 21, 2002
20
Hi,
I have a command button that when I click it, it opens a form that I have assigned it to open, but instead of it displaying the records I have all ready inputted, I just want it to open up to a blank record. How do I do that? At the moment this is the code that I have attached to the command button

Private Sub Workorders_Click()
On Error GoTo Err_Workorders_Click
If IsNull([CustomerID]) Then
MsgBox "Enter Law Firm name before entering billing information."
Else
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenForm "Billing"
End If

Exit_Workorders_Click:
Exit Sub

Err_Workorders_Click:
MsgBox Err.Description
Resume Exit_Workorders_Click
End Sub

Thanks in advance for any suggestions.
 
try
DoCmd.OpenForm "Billing", , , acNew

Hope this helps
Hymn
 
Thanks for the suggestion, it is almost perfect. I did what was suggested and first it brings up a Message Box that says "You can't use find or replace now", with an ok button. I click the ok button and the blank record will come up of which I can input new information. How can I keep the Message Box from coming up every time I click the command button....Thanks.
 
Hi,

Well, I'm no access expert, but I don't think you need to use VBA to do that, if you just set the DataEntry property of the form you want to open to yes, it'll automatically open up a blank record rather than showing the existing ones.

Hope this is of some help

Martin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top