Have a macro get the contents of a field not included in a Base form

I need to set my macro launched from a Base form to find the contents of a field not included in the form document (Specifically, I need the field “ID”, which is an auto-incremented primary key unsigned integer.)
Is this possible, and if it is, how would it be done?

I think I would start with

oMainForm = ThisComponent.DrawPage.Forms.getByName("MainForm")

Typically, after that, I would proceed to set another object to the control that has the value that I want and get its SelectedValue (assuming it’s a listbox), but in this case, there’s no control to use.

May be so?

  oColumns = oMainForm.getColumns()
  oIdField = oColumns.getByName("ID")
  nCurrentID = oIdField.getLong()