Make the record number = a field of a form

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

Guest

Is it possible to make a "field" in a form (the item number) to be the
"record number".

Or can I make something that requests that "field" (the item number) and
have it print that form only?
 
Yes! Put the following code in the OnCurrent event of the form:
Me!NameOfTextBox = Me.CurrentRecord

I'm assuming here your form displays a single record.
 
I entered the code and I get this error message:

Microsoft Office Access can'f find the macro 'ME!Item Number =
ME.CurrentRecord'
The macro(or its macro group) doesn't exist, or the macro is new but hasn't
been saved.
Note that when you enter the macrogoupname.macroname syntax in an argument,
you must specify the name the macro's group was last saved under.

Please advice,
monster
 
I entered the code and I get this error message:

Microsoft Office Access can'f find the macro 'ME!Item Number =
ME.CurrentRecord'
The macro(or its macro group) doesn't exist, or the macro is new but hasn't
been saved.

It would seem you're typing the code directly into the event property.
The event property should instead contain [Event Procedure].

Instead, click the ... icon by the property, invoke the Code Builder,
and put this line between the Sub and End Sub lines which Access will
provide for you. Select Debug... Compile <my database> from the menu,
close the VBA editor, and try it then.

John W. Vinson[MVP]
 
Back
Top