Open form in edit mode

T

Tim Reid

Using the switchboard manager to open a form in edit mode
results in the form opening in add mode. Need to go
Records...Remove filter/sort for all records to show.
What am i missing?
 
J

Joseph Hand

I have one form and 2 buttons... on the first tab, I have
a button for adding customers, which opens the form in add
mode. The "On Click" code is:
************************
Private Sub AddCustomer_Click()
On Error GoTo Err_AddCustomer_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmCustomer"
DoCmd.OpenForm stDocName, acNormal, , stLinkCriteria,
acFormAdd

Exit_AddCustomer_Click:
Exit Sub
************************

For the second tab, I use a button to open the field in
edit mode, and the code for this "On Click" is:

************************
Private Sub EditCustomer_Click()
On Error GoTo Err_EditCustomer_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmCustomer"
DoCmd.OpenForm stDocName, acNormal, , stLinkCriteria,
acFormEdit

Exit_EditCustomer_Click:
Exit Sub
************************

The difference is the 'acFormEdit' versus the 'acFormAdd'
in the two.

hope this helps...

jh
 
V

Van T. Dinh

Are you sure you used the "Open Form in Edit mode" command rather than the
"Open Form in Add mode" command?

If you look in the [Switchboard Items] Table, the "Command" number should be
3 and not 2 for the relevant item(s).
 
T

Tim

The command number is indeed 3.
-----Original Message-----
Are you sure you used the "Open Form in Edit mode" command rather than the
"Open Form in Add mode" command?

If you look in the [Switchboard Items] Table, the "Command" number should be
3 and not 2 for the relevant item(s).

--
HTH
Van T. Dinh
MVP (Access)



Tim Reid said:
Using the switchboard manager to open a form in edit mode
results in the form opening in add mode. Need to go
Records...Remove filter/sort for all records to show.
What am i missing?


.
 
T

Tim

Hi Joseph, Unfortunately I am going through the
switchboard which lacks that amount of control.
 
V

Van T. Dinh

Check the Filter Property of your Form. You may have something that filter
out the existing Records and therefore the NewRec is the CurrentRecord in
your "Edit-mode" Form.

If nothing, check the VBA code of your Form for "Filter" and "FilterOn" as
Filter can be set in code also.
 
K

kidvegas19

I had the same problem as Tim. Using the clues Joseph Hand gave, I
found this in the VB code for the form_switchboard in the Private
Function HandleButtonClick(intBtn As Integer):

' Open a form.
Case conCmdOpenFormBrowse
DoCmd.OpenForm rs![Argument]

I had to change the last line to:

DoCmd.OpenForm rs![Argument], , , , acFormEdit

When I saved the change, I was prompted to save to the form_switchboard
and the form the switchboard is to open in edit mode. This solved the
problem.
 

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