After Add Record, Put Cursor in specific Text Box

Hi,  I had the wizard set up a button to add record (it puts in the code 
below in the On Click property of the button).  I'd then like to have the 
focus go to text box  [ProjectType].  I don't know how to do that.  TIA :)

Private Sub cmdAddRecord_Click()
On Error GoTo Err_cmdAddRecord_Click


    DoCmd.GoToRecord , , acNewRec

Exit_cmdAddRecord_Click:
    Exit Sub



Err_cmdAddRecord_Click:
    MsgBox Err.Description
    Resume Exit_cmdAddRecord_Click
    
End Sub

0
Utf
8/6/2007 1:40:01 PM
access 16762 articles. 3 followers. Follow

4 Replies
1439 Views

Similar Articles

[PageSpeed] 47


Private Sub cmdAddRecord_Click()
On Error GoTo Err_cmdAddRecord_Click

    If Me.Dirty Then Me.Dirty = False
    If Not Me.NewRecord Then RunCommand acCmdRecordsGotoNew
    Me.[Project Type].SetFocus

Exit_cmdAddRecord_Click:
    Exit Sub

Err_cmdAddRecord_Click:
    MsgBox Err.Description
    Resume Exit_cmdAddRecord_Click
End Sub

-- 
Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Karin" <Karin@discussions.microsoft.com> wrote in message 
news:2ED6214F-C8F5-4828-87C6-9CAB77B6C4C8@microsoft.com...
> Hi,  I had the wizard set up a button to add record (it puts in the code
> below in the On Click property of the button).  I'd then like to have the
> focus go to text box  [ProjectType].  I don't know how to do that.  TIA :)
>
> Private Sub cmdAddRecord_Click()
> On Error GoTo Err_cmdAddRecord_Click
>
>
>    DoCmd.GoToRecord , , acNewRec
>
> Exit_cmdAddRecord_Click:
>    Exit Sub
>
>
>
> Err_cmdAddRecord_Click:
>    MsgBox Err.Description
>    Resume Exit_cmdAddRecord_Click
>
> End Sub
> 

0
Allen
8/6/2007 2:07:19 PM
I got it (it works but I don't know if its really right):

Private Sub cmdAddRecord_Click()
On Error GoTo Err_cmdAddRecord_Click


    DoCmd.GoToRecord , , acNewRec

Exit_cmdAddRecord_Click:
Me.[ProjectType].SetFocus
    Exit Sub



Err_cmdAddRecord_Click:
    MsgBox Err.Description
    Resume Exit_cmdAddRecord_Click
    
End Sub


"Ofer Cohen" wrote:

> Try
> 
> Me.[ProjectType].SetFocus
> 
> -- 
> Good Luck
> BS"D
> 
> 
> "Karin" wrote:
> 
> > Hi,  I had the wizard set up a button to add record (it puts in the code 
> > below in the On Click property of the button).  I'd then like to have the 
> > focus go to text box  [ProjectType].  I don't know how to do that.  TIA :)
> > 
> > Private Sub cmdAddRecord_Click()
> > On Error GoTo Err_cmdAddRecord_Click
> > 
> > 
> >     DoCmd.GoToRecord , , acNewRec
> > 
> > Exit_cmdAddRecord_Click:
> >     Exit Sub
> > 
> > 
> > 
> > Err_cmdAddRecord_Click:
> >     MsgBox Err.Description
> >     Resume Exit_cmdAddRecord_Click
> >     
> > End Sub
> > 
0
Utf
8/6/2007 2:18:05 PM
Hi,
Move it from the  Exit_cmdAddRecord_Click section, other wise if there is an 
error it will run this line of code and might produce another error


Private Sub cmdAddRecord_Click()
On Error GoTo Err_cmdAddRecord_Click

    DoCmd.GoToRecord , , acNewRec
    Me.[ProjectType].SetFocus

Exit_cmdAddRecord_Click:
    Exit Sub

Err_cmdAddRecord_Click:
    MsgBox Err.Description
    Resume Exit_cmdAddRecord_Click
    
End Sub


-- 
Good Luck
BS"D


"Karin" wrote:

> I got it (it works but I don't know if its really right):
> 
> Private Sub cmdAddRecord_Click()
> On Error GoTo Err_cmdAddRecord_Click
> 
> 
>     DoCmd.GoToRecord , , acNewRec
> 
> Exit_cmdAddRecord_Click:
> Me.[ProjectType].SetFocus
>     Exit Sub
> 
> 
> 
> Err_cmdAddRecord_Click:
>     MsgBox Err.Description
>     Resume Exit_cmdAddRecord_Click
>     
> End Sub
> 
> 
> "Ofer Cohen" wrote:
> 
> > Try
> > 
> > Me.[ProjectType].SetFocus
> > 
> > -- 
> > Good Luck
> > BS"D
> > 
> > 
> > "Karin" wrote:
> > 
> > > Hi,  I had the wizard set up a button to add record (it puts in the code 
> > > below in the On Click property of the button).  I'd then like to have the 
> > > focus go to text box  [ProjectType].  I don't know how to do that.  TIA :)
> > > 
> > > Private Sub cmdAddRecord_Click()
> > > On Error GoTo Err_cmdAddRecord_Click
> > > 
> > > 
> > >     DoCmd.GoToRecord , , acNewRec
> > > 
> > > Exit_cmdAddRecord_Click:
> > >     Exit Sub
> > > 
> > > 
> > > 
> > > Err_cmdAddRecord_Click:
> > >     MsgBox Err.Description
> > >     Resume Exit_cmdAddRecord_Click
> > >     
> > > End Sub
> > > 
0
Utf
8/6/2007 2:30:02 PM
Perfect - thank you.

"Ofer Cohen" wrote:

> Hi,
> Move it from the  Exit_cmdAddRecord_Click section, other wise if there is an 
> error it will run this line of code and might produce another error
> 
> 
> Private Sub cmdAddRecord_Click()
> On Error GoTo Err_cmdAddRecord_Click
> 
>     DoCmd.GoToRecord , , acNewRec
>     Me.[ProjectType].SetFocus
> 
> Exit_cmdAddRecord_Click:
>     Exit Sub
> 
> Err_cmdAddRecord_Click:
>     MsgBox Err.Description
>     Resume Exit_cmdAddRecord_Click
>     
> End Sub
> 
> 
> -- 
> Good Luck
> BS"D
> 
> 
> "Karin" wrote:
> 
> > I got it (it works but I don't know if its really right):
> > 
> > Private Sub cmdAddRecord_Click()
> > On Error GoTo Err_cmdAddRecord_Click
> > 
> > 
> >     DoCmd.GoToRecord , , acNewRec
> > 
> > Exit_cmdAddRecord_Click:
> > Me.[ProjectType].SetFocus
> >     Exit Sub
> > 
> > 
> > 
> > Err_cmdAddRecord_Click:
> >     MsgBox Err.Description
> >     Resume Exit_cmdAddRecord_Click
> >     
> > End Sub
> > 
> > 
> > "Ofer Cohen" wrote:
> > 
> > > Try
> > > 
> > > Me.[ProjectType].SetFocus
> > > 
> > > -- 
> > > Good Luck
> > > BS"D
> > > 
> > > 
> > > "Karin" wrote:
> > > 
> > > > Hi,  I had the wizard set up a button to add record (it puts in the code 
> > > > below in the On Click property of the button).  I'd then like to have the 
> > > > focus go to text box  [ProjectType].  I don't know how to do that.  TIA :)
> > > > 
> > > > Private Sub cmdAddRecord_Click()
> > > > On Error GoTo Err_cmdAddRecord_Click
> > > > 
> > > > 
> > > >     DoCmd.GoToRecord , , acNewRec
> > > > 
> > > > Exit_cmdAddRecord_Click:
> > > >     Exit Sub
> > > > 
> > > > 
> > > > 
> > > > Err_cmdAddRecord_Click:
> > > >     MsgBox Err.Description
> > > >     Resume Exit_cmdAddRecord_Click
> > > >     
> > > > End Sub
> > > > 
0
Utf
8/6/2007 2:48:16 PM
Reply:

Similar Artilces:

Item.Add()
I have been using the following code as part of a web application. Set ol = CreateObject("Outlook.Application") Set ns = ol.GetNamespace("MAPI") Set fdr = ns.Folders("Public Folders").Folders("All Public Folders").Folders("sg.com").Folders("JOB SCHEDULE") Set itm = fdr.Items.Add() Set psn = itm.UserProperties.Add("SGPersonnel",1, True) psn.Value = "Jeff" Set act = itm.UserProperties.Add("ActID",3, True) act.Value = "123456789" Set cust = itm.UserProperties.Add("Cust...

OWA, can i put username without domain?
Hi all, I have 2 questions as follow: I just setup an exchange2003 as test. In owa, Do i have to put in my whole email address as the username or there is a way to shorten it to username only for login? I have this c1030af3 error when i try to get into public folders in ex. manager. But the problem solved by disable auto-protect in norton anti-virus. Is Norton conflict with exchange 2003? is there a fix for that? Thanks a lot all. Hi Derrick, Take a look at this KB Article: http://support.microsoft.com/kb/820378 It will explain how to edit the OWA Login.asp page to automatically i...

Duplicating text in Word 2007
Hi, I've got a template I previously did for Word 2003 where I basically had several {macrobutton nomacro Type something here} fields. Now, in Word 2007, I see I have the option to actually add a Text content control, which looks fantastic :) BUT, is there a way of making it so that if I type something in one content control, the same text value is automatically added into the second one as well? Or even a third? How can I do that? Found out that if I insert a comment field and copy that field, they both work as I want! Yay! But, the comment field I insert via the Insert...

Spell checking current record
I have added a spell check to a database using DoCmd.RunCommand acCmdSpelling Which works, I just want it to spell check the current record, not the whole database. Is that possible? "jamccarley" <jamccarley@discussions.microsoft.com> wrote in message news:D0ED2E35-3346-41D9-939D-56F9F345C309@microsoft.com... >I have added a spell check to a database using > > DoCmd.RunCommand acCmdSpelling > > Which works, I just want it to spell check the current record, not the > whole > database. Is that possible? IIRC, if you select the record...

Cannot insert pictures in Pubisher. Text also disappears!
I have worked for several hours on a newsletter, now everything changes. Photos overlay on print and print disappears. Read the third FAQ here http://ed.mvps.org/Static.aspx?=Publisher/FAQs -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com http://officebeta.iponet.net/en-us/publisher/FX100649111033.aspx "Disgusted" <Disgusted@discussions.microsoft.com> wrote in message news:421A5715-4D0A-4EC9-8C94-941B4B9DBA9F@microsoft.com... >I have worked for several hours on a newsletter, now everything changes. > Photos over...

saving new record in subform
The main form is frmCustomers, with a subform subfrmContacts. The subform has custom navigation buttons, cmdAddContact and cmdDeleteContact. On the subform, AllowAdditions = false. When the user clicks cmdAddContact, I set AllowAdditions = true. On the AfterInsert Event, I set the AllowAdditions back to false. If the user clicks cmdAddContact, then types in the info, then clicks cmdAddContact again, it says, "can't go to the specified record." If I click outside the subform, then back in the subform, I can add a record. I need a better solution! Thank you, Steve S...

Saving Outlook Email As Text File Extract
Hello Outlook Group: I'm normally an Access and Excel VBA programmer, but my client wants me to scrape the text from a select email address and insert it into an Access memo column. Does anyone know how to configure Outlook (VBA approach would be fine) so that when an email is received in a selected account, the message would also be extracted to a directory as a text file and then the Outlook message would be moved to some history folder. Once the text file exists in a predefined folder , I will just have Access periodically check the folder for files, grab the text, ...

digital voice recorder w/software
From: "ept" <ept@prodigy.net> Subject: Looking for a digital voice recorder w/software: Date: Wednesday, February 25, 2004 6:52 PM Looking for digital voicce recorder w/software that would go straight to outlook 2000 task list or a folder in outlook. Thanks in advance Pat Tichenor ...

Add Data to Powerpoint
Is there a website, or can someone show me how to open a Powerpoint template and add data to it using the OpenXML format? I am very new to using any type of XML, and really need a good example (with lots of comments) to get me started. Thanks ...

Text Boxes are not printing
Version: 2008 Operating System: Mac OS X 10.4 (Tiger) Processor: Power PC Installed Office 2008 over Office v.X and worked on a monthly newsletter as a new document,using Word, but copying and pasting from the previous month before proceeding to make changes. Print preview looked alright but the text boxes did not print. Is it a printer problem or a doc problem? It could be a problem with the printer, or it could be a wrong setting in Word. First of all, make sure you are using the latest driver for your printer; that is a useful precaution, as you use your printer with a number of applicati...

adding url in rich text
Hi, When i type a url into the body of a rich text email, such a www.blah... when the email is sent it automatially inserts.. "HYPERLINK "www,blah..." in the message, in front of the url i originally typed., and then th actual url after it. This wasn't happening before, does anyone know how to stop it? many thank ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com ...

zoom box on saved html page?
is there a way to put a real zoom box to zoom in on a largeish sheet so when i save it as a web page, ppl can zoom in and out out the page please? please bare in mind im VERY new at this, but would love to do this as when i create a sheet i am zoomed in to 50% and i can read everything, but when i save the page its 100% and way to small so would like to be able to zoom in and out on the html page just like i can in excel, any help appreciated, thanks K ...

convert text "20100315" to date format
Hi, I have some data exported from a system, the date is a text displayed as "20100315" which should read yyyymmdd. I need to convert this text to another date format showing mm/dd/yyyy in text for importing into another system. As the text format yyyymmdd does not contain any "/" or "-" so using text to column will be a difficulty. Please advise how could I handle this. Thanks a lot. Best Regards, Terry =TEXT(DATE(LEFT(A1,4),MID(A1,5,2),RIGHT(A1,2)),"mm-dd-yyyy") and copy paste special-values. -- Regards Dave Hawle...

Combo box required
I have a series of three forms, editing two tables. In the first form, there is a combo box in which the user selects a place name (where the work was performed). The user then has two choices (staff effort or volunteer effort) in button format; they go to different forms. The place name (combo box) is required in the underlying table, but that record is not "saved" til about three forms down the road, so we don't hit an error message til them. Similarly, BeforeUpdate code isn't preventing the user from moving to the next form, but in case I did something wrong: Priva...

Cannot import more than the top 15 Records
Hi I'm trying to import some recrods with the import wizard. I have the problem, that the 15 top records can be imported. The rest fails. We have rollup 3 on the crm server (4.0) installed! Had someone the same problem? Thank's Michel On Apr 15, 6:29=A0pm, "Michel M=FCller" <mmuel...@ambit.ch> wrote: > Hi > > I'm trying to import some recrods with the import wizard. > > I have the problem, that the 15 top records can be imported. The rest fai= ls. > > We have rollup 3 on the crm server (4.0) installed! > > Had someone the same pro...

Double-byte text in CSV file
I have a .csv file that contains double-byte Japanese/Chinese text. When I try to open this in file in Excel , the double-byte text does not appear correctly. How can I overcome this ? Is there something that needs to be added to the top of the file ? Thanks in advance Des Do you have Chinese fonts installed? Have you selected a Chinese typeface for the columns that contain double-byte characters Sandr ----- Des Carroll wrote: ---- I have a .csv file that contains double-byte Japanese/Chinese text. When try to open this in file in Excel , the double-byte text do...

Calendar-text on each day
How do I make the same text appear on every Monday of a calendar? Or every weekday? Or every Thursday? I think you know what I am saying. I have been cutting and pasting a text box but I can't do that for the entire year... THANKS!! Edit, open the Office clipboard, you can collect 24 items. When you want to insert text in a certain calendar cell, place your cursor in the cell, click the collected item. -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "Angee" <Angee@discussions.microsoft.com> wrote in messag...

font dialog box
I'm trying to reset my shortcuts, one of which is to reach the font dialog box itself rather than the subentries. In Tools, Customize, Keyboard, what do I set a shortcut for that will take me to the dialog box which let's me do character spacing, font, and other things associated? I keep getting just one facet of it. What would I do if you weren't there?! Look for the FormatFont command (in the All Commands category). Note that if you are trying to reset all of the *default* shortcuts, the Reset All button will take care of that... -- Stefan Blom Microsoft...

Cash Flow Add Item
With Money 2004, has anyone been able to get the "add item" feature in the cash flow analysis to work? It walks you through the steps but nothing ever shows up. The only way to add an item is through the cash flow scenario which will add a "bills-deposit" entry. TIA No such item shows up. Thanks for the respone though. Any other ideas/experiences with this from anyone? Seems like a significant bug in 2004. >-----Original Message----- >Yes. Look for an item called Cash Flow item. > >"jaatea" <jaatea@hotmail.com> wrote in message >...

How can i add Item Line Number in Invoice with Report Writer?
Hello In SOP i wont to print a Blank Paper Invoice but i need to add Line Number(or Record Number) How can i add Item Line Number in Invoice with Report Writer? Best Regards Monzer Hi Try add field "LineNumber" from table "Sales Document Temp" I using polish version greatplains, and into my version table name is "PL Sales Document Temp", maybe into your version is similarly. PS. sorry for my english ;) Rafal On Jun 11, 2:54 pm, rafal...@wp.pl wrote: > Hi > Try add field "LineNumber" from table "Sales Document Temp" > I using po...

Text boxes in Excel 2003 chart won't print
Is this a bug in Excel 2003? I have a workbook with lots of charts, each on their own chart worksheet. On most of these charts, I'd drawin text boxes, arrows, lines, etc. I've done this for years with no issue. However on this one file, none of the text boxes will print, they don't show up in a .pdf conversion, and they don't show up in a copy/paste of the chart (to another application). Any ideas? Thanks in advance Chris, If you double click the text box(es) & go to the properties tab, make sure the "Print object" box is checked. "ChrisM" wrot...

Add a Project Web Access as another section on an existing sharepo
Hello all, I have the following scenario: I have created a new Project web Access in this location http://localhost:83/projectserv , i have a sharepoint site as http://localhost:83 I would like to add the PWA as a section on th sharepoint site.I try to create a new site on the sharepoint site and change the link pointing to the PWA and is not enough because it take me to the main PWA. Thanks in advance PWA, by its very nature is its own site collection. I am a bit confused however, is your goal to have a URL of: http://localhost:83/projectserv/PWA or http://localhost:...

exporting data into text file?
Hi, I need to export my data in a very strict text format like this: First name: 15 characters Last name: 20 characters Street: 20 characters House number: 5 characters etc An example would be like this (the underscore symbolizing an empty space: John___________Doe_________________Marlboro_Road_______00023 And the 2nd address would start right after the 00023: John___________Doe_________________Marlboro_Road_______00023Jack___________Jones_______________Kentucky_Road______00088 and so on. Is that at all possible from Access or does this need to be done directly on the SQL Server? Th...

"There are no records to be printed." when printing statements
We have a customer that has open invoices from 10/08 to 3/09. When trying to run a few different statements for this customer, we receive 'There are no records to be printed.' The customer's Statement Cycle in options is set to Monthly. Does anyone know why this is occurring or if anything can be done to retrieve any statements? Thanks What version and build number of GP are you using? Best regards, -- MG.- Mariano Gomez, MIS, MCP, PMP Maximum Global Business, LLC http://www.maximumglobalbusiness.com The Dynamics GP Blogster at http://dynamicsgpblogster.blogspot.com &qu...

Excel Dropdown Box-Toggle button ?
I have a cell (D7) in a spreadsheet, which has either the word "OUT" or "IN" entered manually. The two options are then used in a. "IF" statement to control a numerical value. My question is: can this cell (D7) be made so that a mouse-click can toggle between "IN" and "OUT", so that the words don't have to be typed in every time. Or perhaps a drop-down box where one can select either of the two options. Thanks in Advance, Hagen Sahm Maybe you could just use data|validation to set up a dropdown box? See Debra Dalgleish's si...