MS Access Forum / New Users / May 2005
"GoTo New Record"
|
|
Thread rating:  |
Robin Chapple - 04 May 2005 07:44 GMT I have a form in datasheet view which when opened I need the focus to go to a new record.
I already have a command "GoTo Field".
How do I do that?
Thanks,
Robin Chapple
Nikos Yannacopoulos - 04 May 2005 11:53 GMT Robin,
Open the form in design view, and select the form object (Edit > Select Form). Display the properties window (if not already open) by Vew > Properties, select tab Events, place the cursor in the box next to On Open and click the little button with the ellipsis sign (...) that appears on the right; select Macro Builder, give the macro a meaningful name (so you can tell what it is when you see it later) and add a single action to it, GoToRecord, with argument Record set to New. Save and return to the form. The job is done.
HTH, Nikos
> I have a form in datasheet view which when opened I need the focus to > go to a new record. [quoted text clipped - 6 lines] > > Robin Chapple BruceM - 04 May 2005 13:01 GMT Just out of curiosity, why a macro instead of a VBA procedure? There seems to be some difference between the two, but I have never quite sorted out what it is.
> Robin, > [quoted text clipped - 20 lines] > > > > Robin Chapple Nikos Yannacopoulos - 04 May 2005 13:37 GMT Hi Bruce,
A macro in this case, simply because the OP occurred in the GettingStarted NG, and the question itself justifies the selection of NG too... new users seem to feel more comfortable with Macros.
In my experience, the difference is that code provides far more flexibility and control, at the cost of a higher expertise level requirement. I think once you cross the line, there's no turning back!
Regards, Nikos
> Just out of curiosity, why a macro instead of a VBA procedure? There seems > to be some difference between the two, but I have never quite sorted out what [quoted text clipped - 24 lines] >>> >>>Robin Chapple BruceM - 04 May 2005 17:56 GMT Thanks for the reply. A book I read when I was first using Access said that as of Access 2000 VBA procedures were the way to go, although macro support was still available. By using VBA procedures from the beginning I guess I jumped in the deep end, but certainly not for the first time.
> Hi Bruce, > [quoted text clipped - 37 lines] > >>> > >>>Robin Chapple Nikos Yannacopoulos - 05 May 2005 08:21 GMT Bruce,
Though I'm still on A2K myself, I believe macros are still there in A2K3, and for a good reason in my opinion: they provide a far easier entry point to automation for the novice user... not everyone jumps in the deep like you! I'd been using macros for a long time before I jumped. Now that I have, i would also say that VBA is the way to go (eventually), but for different reasons, not for discontinued support (if that's the case).
Regards, Nikos
> Thanks for the reply. A book I read when I was first using Access said that > as of Access 2000 VBA procedures were the way to go, although macro support [quoted text clipped - 42 lines] >>>>> >>>>>Robin Chapple Robin Chapple - 04 May 2005 23:00 GMT Nikos,
I have been using VBA for several years but still consider myself a "getting started" customer because of my lack of knowledge.
When I get this macro working I will convert it to VBA.
Robin
>Hi Bruce, > [quoted text clipped - 37 lines] >>>> >>>>Robin Chapple Nikos Yannacopoulos - 05 May 2005 08:23 GMT > I have been using VBA for several years but still consider myself a > "getting started" customer because of my lack of knowledge. I guess that makes you a rare exception :-)
Nikos
Robin Chapple - 04 May 2005 22:57 GMT Nikos,
Thanks that worked for the first member. When I selected the next member I had to scroll again.
Now this may be associated with the fact that the form is a sub form with members called from a combo box on the main form.
Robin
>Robin, > [quoted text clipped - 20 lines] >> >> Robin Chapple Nikos Yannacopoulos - 05 May 2005 08:18 GMT > Now this may be associated with the fact that the form is a sub form > with members called from a combo box on the main form. Yes, that's what makes the difference! We have been using the Form_Open event for a subform, which obviously only opens once, so the event won't fire next time. In light of the new information, you need to use a different event to trigger the action, and thst's the combo's On Change event; since you're familiar with VBA code, put this in the combo's On Change event:
Me.YourSubformNameHere.SetFocus DoCmd.GoToRecord , , acNewRec
This should do the trick.
Regards, Nikos
robinski@melbpc.org.au - 06 May 2005 01:48 GMT Nikos,
I supplied some wrong information. I am not using a combo box I am using a List Box and there in no "On Change" event.
Is there another option please?
Robin
>> Now this may be associated with the fact that the form is a sub form >> with members called from a combo box on the main form. [quoted text clipped - 12 lines] >Regards, >Nikos robinski@melbpc.org.au - 07 May 2005 05:10 GMT I've settled this one by changing to a combo box and using your code.
Bingo! she's a good one.
Thanks very much
Robin
>> Now this may be associated with the fact that the form is a sub form >> with members called from a combo box on the main form. [quoted text clipped - 12 lines] >Regards, >Nikos robinski@melbpc.org.au - 07 May 2005 05:12 GMT I've settled this one by changing to a combo box and using your code.
Bingo! she's a good one.
Thanks very much
Robin
>> Now this may be associated with the fact that the form is a sub form >> with members called from a combo box on the main form. [quoted text clipped - 12 lines] >Regards, >Nikos Nikos Yannacopoulos - 10 May 2005 08:44 GMT Robin,
Sorry for the delay, I was away for a few days. Glad you worked it out. You could have done it just as well with the listbox, using the On Click event instead.
Nikos
> I've settled this one by changing to a combo box and using your code. > [quoted text clipped - 21 lines] >>Regards, >>Nikos robinski@melbpc.org.au - 11 May 2005 01:06 GMT Nikos,
Thanks for that further information. I will take that option because I like the way that the list box displays the list without the need for a click.
Robin
>Robin, > [quoted text clipped - 29 lines] >>>Regards, >>>Nikos
|
|
|