1

I'm building a relatively simple datasheet-style form for selecting a record (which will be used to populate another form)

The form pulls from a query with multiple columns. Since it's counter-intuitive to have a highlighted field and data entry cursor when all the user wants to do is select a record, I added the following code to each field on the form:

Private Sub Model_Enter()
    RunCommand acCmdSelectRecord
End Sub

This works fine for the "Model" field, but for every other field it gives me the following error:

Run-time error 3125

" is not a valid name. Make sure that it does not include invalid characters or punctuation and that it is not too long.

There's literally nothing else going on in this form, so I have no idea what the issue is, or why the code works for Model and breaks for everything else. Anyone else run into this issue?

4

1 に答える 1

1

I suggest you use the On Current event, rather than write code for each control. It is also possible to use conditional formatting and a little code to highlight a record.

于 2012-07-18T19:01:33.850 に答える