Command Button Question

B

Bob

When I click on my command button on Main Menu it always opens Record No1,
can I have it open at first blank record (Add Record)

Thanks in advance.........Bob Vance
 
B

Bob

Sorry here is the code:
Private Sub cmdOwnerInfo_Click()
DoCmd.OpenForm "frmOwnerInfo"
End Sub
 
B

Bob

Rick I lost all my owners when I changed the code, did give me a blank form
but lost all the rest....Bob
 
B

Bob

Error:
Private Sub cbOwnerAll_AfterUpdate()
If cbOwnerAll.Text = "" Or IsNull(cbOwnerAll.Text) = True Then
Exit Sub
End If
*Yellow Line*DoCmd.FindRecord val(cbOwnerAll.value), , True, , True,
acAll, True
Me.Filter = "OwnerID=" & val(cbOwnerAll.value)
Me.FilterOn = True
Thanks Bob
 
R

Rick Brandt

Bob said:
Rick I lost all my owners when I changed the code, did give me a blank form
but lost all the rest....Bob

"Add" mode or "Data Entry" mode hides existing records so that the form opens
faster and is ready to enter NEW records. Sounded like that is what you wanted.
You can add code to the Open event instead...

DoCmd.RunCommand acCmdRecordsGoToNew

Which will show all records but position you at the new record at the end of the
RecordSet, but that is not recommended if your table is large and being pulled
over a network.
 
B

Bob

Rick that "Add" mode is good just that my 2 drop down list to find a client
wont work

Private Sub cbOwnerAll_GotFocus()
cbOwnerAll.Requery
End Sub

Private Sub cbOwner_AfterUpdate()
If cbOwner.Text = "" Or IsNull(cbOwner.Text) = True Then
Exit Sub
End If
DoCmd.FindRecord val(cbOwner.value), , True, , True, acAll, True
Me.Filter = "OwnerID=" & val(cbOwner.value)
Me.FilterOn = True

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top