How to capture the name of the current form for a field

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

Guest

I have a note tracking table that I want to be able to use for several
different forms (that are all accessing data from different tables).

So, when I create a new note record, I want to capture which form was active
when the note was created then stuff that name in a field called CurrentForm
so that I can run a query on that data later .

How do I do this?
 
Use the Before Upate event of the form to write its Name into your field:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.[NameOfYourFieldHere] = Me.Name
End Sub
 
BLTibbs,
There maybe a smart way of doing it. the way i know how is to

For i = 0 to currentproject.AllForms.count -1
If (currentproject.AllForms(i).isloaded) then
strOpenform = currentproject.AllForms(i).Name
endif
next i

this is assuming you only have 1 form open
 
Back
Top