Add Note Button on already opened form

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

Guest

I'm adding an "add note" button to a form I've created (or maybe it will have
to go on another form.....). Anywho, I've got a form and it has this add
note button, and I click it and the add note form comes up. However, I need
two things to happen, maybe even three:

1. The "add note" form appears behind both the already opened form AND the
switchboard. I can't think of a case where I want this "add note" form to
open and NOT be in the front, so I went to that form, opened the properties,
and went to the "on open" event, but I don't know how to tell it to come to
the front when opened. Is that even possible?

2. I'd also like to tell it where to put the cursor, if that's possible

3. Finally, I'd like to fill in one piece of info from the original form I
had opened into the "add note" form. I need the note that's added by filling
out the form associated with the file that was opened in the original form
(the form wwhere the "add note" button is).

Any help would be appreciated. Hand-holding preferred, but a good tutorial
is always welcome if someone knows of one.

Thanks,
cw
 
Cheese
1. Try setting the Note form to PopUp, and make it Modal, so the user can't do
anything but enter note data and then close the note form.
2. Use the OnCurrent event of the Note form to do a
DoCmd.GoToControl "SomeField"
3. Since the original "calling" form is still open, you can refer to any value (ex.
Field1) on that form to pass to the Note form.
SomeFieldOnNoteForm = Forms!frmTheCallingFormName!Field1
 
Thanks Al!

Got the first two knocked out . I'm a little confused on the third one
though. Does that code go in the "default" thing under the data tab in the
properties window?

Also, if you have time and patience for one more, is there a way to tell my
case note (or any other input form) not to "save" until a "save" button is
pressed (as opposed to it saving to a table as it's entered?

Thanks again. That first response helped a bunch.

CW
 
Cheese,
3. Use the same OnCurrent event to set the value of the Note field to the value from
the calling form.

None of the data entered into a record is actually saved until a Refresh or Requery is
performed via code, or when the user moves off that record to another, or the form closes,
or you move from a main form to a subform (and vice versa).
Try deleting the record OnClose. Set a Module level variable to tell OnClose that you
came from the Save button, as opposed to the normal Form/Close or (X) button.

Option Compare Database
Option Explicit
Dim SaveTheRecord as Boolean

Private Sub SaveButton_OnClick()
SaveTheRecord = True
End Sub

Private Sub Form_Close()
If SaveThe Record = True Then
DoCmd.Close
SaveTheRecord = False
Else
DoCmd.RunCommand acCmdDeleteRecord
End If
End Sub

I didn't test, I'm headed out the door... but that should do it.
 

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