opening a form in edti mode

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a main form that I enter quotes into. I would like to be able to open
a specific quote in edit mode. I already have a switchboard item that opens
the form in edit mode, but not a specific form entry. I would like to have a
switchboard button that promts the user to enter the quote ID that needs
editing, and then open the form in edit mode showing that quote.
thanks
 
nikki said:
I have a main form that I enter quotes into. I would like to be able
to open a specific quote in edit mode. I already have a switchboard
item that opens the form in edit mode, but not a specific form entry.
I would like to have a switchboard button that promts the user to
enter the quote ID that needs editing, and then open the form in edit
mode showing that quote.
thanks

The built-in Switchboard doesn't provide a means to do this. You can
get a lot more flexibility, though, by creating your own form with
command buttons on it for which you provide code for each button's Click
event. For example, code for a command button to do what you describe
might look like this:

'----- start of example code -----
Private Sub cmdOpenQuote_Click()

Dim strID As String

strID = InputBox("Enter quote ID:")

If Len(strID) > 0 Then

DoCmd.OpenForm "frmQuotes", _
WhereCondition:="QuoteID=" & strID

End If

End Sub
'----- end of example code -----

That code assumes that QuoteID is a numeric field. If it's text, then
you need to put quotes around the value of strID. Probably
single-quotes (') will do:

DoCmd.OpenForm "frmQuotes", _
WhereCondition:="QuoteID='" & strID & "'"
 
The built-in switchboard won't do this. What you can have it do is open a
small form that has an unbound control (textbox, listbox, combo box) to
enter the information. Place an Ok and Cancel button on the form. The Cancel
button will simply close the form. The Ok button will open your other form
in edit mode with the desired record displayed and close the request form.

To open the form with the desired record displayed, pass the QuoteID field
value from the user's entry as the WHERE argument in the DoCmd.OpenForm
call.
 
Two simpler ways.

1) Have the form use a query, not the table itself. In the criteria for
the ID (which does not have to appear in the form) place the following


[Enter the ID of the quote Desired:]

OR

2) develop a small popup size form that has a place for the ID (could
be a dropdown that shows something about that quote) but has the bound
field be the ID. Have a button on that form that calls the other
developed form with the criteria of "[ID] = " & me.formrequestedID

You have have to add quotes around the me.formrequestedID if the
required ID is alphabetic.
And have the switchboard call this small form instead of other form.

Ron
 

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

Back
Top