Re: Debug/Compile Error
- From: "Jeff Conrad" <jeffc@xxxxxxxxxxxxxxxxx>
- Date: Sun, 5 Jun 2005 13:57:07 -0700
These were my previous instructions:
1. Open the form in Design View
2. On the main menu bar go to View | Properties.
This will bring up the form's properties list.
(The dialog box should say "Form" in the upper left corner)
3. On the "All" or "Event" tabs look for an line that says
"On Current"
4. Single click on that line itself and a little arrow will appear at
the right side of this line along with a little button that has three
dots on it (...). Click that button with the three dots and a small
dialog prompt will appear. Select the option that says "Code
Builder" and click OK to go to the code window for this form.
5. Your cursor should be in between these two lines:
Private Sub Form_Current()
End Sub
6. Copy and paste this code *in between* those two lines:
If Me.NewRecord = True Then
Me.MyFirstControlNameHere.SetFocus
End If
7. Now where I have the long word MyFirstControlNameHere
you will need to *replace* that part with the actual name of the
form control you want the cursor to be on for a new record. So
if, for example your first form control is called FirstField change the
code to this:
If Me.NewRecord = True Then
Me.FirstField.SetFocus
End If
Follow me?
8. Compile the code (Debug | Compile from menu bar here)
9. Save and close the form and then test. That's it.
Did you change the code I gave to reflect the name of your actual
first code?
Did you type that code directly onto the form's propertie's list?
Can you show me the code you have right now in the form's current
event? Open the form in Design View and then go to the code window
by selecting View | Code form the menu bar. Find the Current event
and post here what you have there right now.
--
Jeff Conrad
Access Junkie
Bend, Oregon
"faxylady" wrote in message:
news:785992F8-FAF5-4319-B0BB-E5B11C1DE712@xxxxxxxxxxxxxxxx
> This message is directed to Jeff Conrad.
>
> Last week you answered a question for me regarding the cursor not appearing
> on the first line of my form after the 'add new record' button was clicked.
> Following is the entire thread:
>
> Cursor will not start in first field box in Access Database Forms
>
>
> Question
>
>
>
> I put an 'add new record' button on my forms. When I click it to add new
> data, I also have to click in the first field to begin. Why won't the cursor
> automatically appear in the first field after the 'add new record' button is
> clicked?
>
>
>
> Bob Howard 5/31/2005 5:32 PM PST
>
>
>
>
>
> You need to put a setfocus method in the onclick event to move the focus
> off the button you just clicked and onto the data field. Access only moves
> the focus when either the user clicks on something or the program moves it.
> "faxylady" <faxylady@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message Click to
> show or hide original message or reply text.
>
>
> faxylady 5/31/2005 8:09 PM PST
>
>
>
>
>
> Thank you. Please tell me how to do this as I am not advanced enough to
> know what you are talking about. Be explicit with instructions.
>
>
> Jeff Conrad 5/31/2005 5:35 PM PST
>
>
>
>
>
> "faxylady" wrote in message:
> news:F80DEFAD-87E3-4CE3-81EE-35380F6AB896@xxxxxxxxxxxxxxxx > I put an 'add
> new record' button on my forms. When I click it to add new > data, I also
> have to click in the first field to begin. Why won't the cursor >
> automatically appear in the first field after the 'add new record' button is
> > clicked? On the Current event of the form, test to see if you are on a new
> record. If you are, set the focus to whatever control you wish. Something
> like so: Private Sub Form_Current() If Me.NewRecord = True Then
> Me.MyFirstControlNameHere.SetFocus End If End Sub -- Jeff Conrad Access
> Junkie Bend, Oregon
>
>
> Thank you. Please give more explicit instructions as I am a novice to
> Access. "On the Current event of the form, test to see if you are on a new
> record." Tell me how to do this.
>
> Jeff Conrad 5/31/2005 8:52 PM PST
>
>
>
>
>
> "faxylady" wrote in message:
> news:2F745085-C451-47F1-B7C0-6C446A9395AB@xxxxxxxxxxxxxxxx > Thank you.
> Please give more explicit instructions as I am a novice to > Access. "On the
> Current event of the form, test to see if you are on a new > record." Tell me
> how to do this. 1. Open the form in Design View 2. On the main menu bar go to
> View | Properties. This will bring up the form's properties list. (The dialog
> box should say "Form" in the upper left corner) 3. On the "All" or "Event"
> tabs look for an line that says "On Current" 4. Single click on that line
> itself and a little arrow will appear at the right side of this line along
> with a little button that has three dots on it (...). Click that button with
> the three dots and a small dialog prompt will appear. Select the option that
> says "Code Builder" and click OK to go to the code window for this form. 5.
> Your cursor should be in between these two lines: Private Sub Form_Current()
> End Sub 6. Copy and paste this code *in between* those two lines: If
> Me.NewRecord = True Then Me.MyFirstControlNameHere.SetFocus End If 7. Now
> where I have the long word MyFirstControlNameHere you will need to *replace*
> that part with the actual name of the form control you want the cursor to be
> on for a new record. So if, for example your first form control is called
> FirstField change the code to this: If Me.NewRecord = True Then
> Me.FirstName.SetFocus End If Follow me? 8. Compile the code (Debug | Compile
> from menu bar here) 9. Save and close the form and then test. That's it. --
> Jeff Conrad Access Junkie Bend, Oregon Click to show or hide original message
> or reply text.
>
>
>
> I copied and pasted the code as instructed. At instruction #8, I clicked
> Debug from the menu. Compile was greyed out. Then I received an error:
> Compile Error, Expected: Expression. The code I pasted in was highlighted in
> red.
>
>
> Please tell me what to do now.
>
.
- References:
- Debug/Compile Error
- From: faxylady
- Debug/Compile Error
- Prev by Date: Re: Can anybody create a database in case I send the details of softwa
- Next by Date: Re: Syntax Error
- Previous by thread: Debug/Compile Error
- Index(es):
Relevant Pages
|