Form Code help

Hi can someone please help with this?  Trying to understand why this is not 
running? I have one other control on my form with the same code and it runs 
just fine.   When I make a change on the form it will ask for a parameter and 
then debugs with the following highlighted.   Thank you for any help you can 
provide.

DoCmd.RunSQL "UPDATE [Tracking] SET [Tracking].[Contactperson] = '" & _
            Forms![frm Provider Tracking].[Contactperson] & "' WHERE 
([Tracking].[ID])= " & _
            Forms![frmPRTrckg].[ID]




Private Sub Contactperson_AfterUpdate()
    If MsgBox("Propagate Contactperson change?", vbYesNo) = vbYes Then
        'MsgBox ("yes:  " & "UPDATE [Tracking] SET 
[Tracking].[Contactperson] = '" & _
            Me.PRVDR_PH & "' WHERE ([Tracking].[ID])= " & Me.PRVDR_ID)
        'run a query to update
        DoCmd.SetWarnings False
        DoCmd.RunSQL "UPDATE [Tracking] SET [Tracking].[Contactperson] = '" 
& _
            Forms![frm Provider Tracking].[Contactperson] & "' WHERE 
([Tracking].[ID])= " & _
            Forms![frmPRTrckg].[ID]
        DoCmd.SetWarnings True
        
    Else
        'do nothing
    End If
    
End Sub

0
Utf
1/11/2008 4:26:03 PM
access.formscoding 7493 articles. 0 followers. Follow

4 Replies
434 Views

Similar Articles

[PageSpeed] 29

"TotallyConfused" <TotallyConfused@discussions.microsoft.com> wrote in 
message news:3781E497-4FC8-4BF3-A638-679E41B54CD9@microsoft.com...
> Hi can someone please help with this?  Trying to understand why this is 
> not
> running? I have one other control on my form with the same code and it 
> runs
> just fine.   When I make a change on the form it will ask for a parameter 
> and
> then debugs with the following highlighted.   Thank you for any help you 
> can
> provide.
>
> DoCmd.RunSQL "UPDATE [Tracking] SET [Tracking].[Contactperson] = '" & _
>            Forms![frm Provider Tracking].[Contactperson] & "' WHERE
> ([Tracking].[ID])= " & _
>            Forms![frmPRTrckg].[ID]



Are "frm Provider Tracking" and "frmPRTrckg" supposed to be the same form? 
If so, one of those names is wrong.

What parameter does it ask you for?

-- 
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

0
Dirk
1/11/2008 6:05:20 PM
Thank you.  Yes the forms name should be the same - fixed that.  But it is 
still prompting me for Contactperson.  What is wrong?

"Dirk Goldgar" wrote:

> "TotallyConfused" <TotallyConfused@discussions.microsoft.com> wrote in 
> message news:3781E497-4FC8-4BF3-A638-679E41B54CD9@microsoft.com...
> > Hi can someone please help with this?  Trying to understand why this is 
> > not
> > running? I have one other control on my form with the same code and it 
> > runs
> > just fine.   When I make a change on the form it will ask for a parameter 
> > and
> > then debugs with the following highlighted.   Thank you for any help you 
> > can
> > provide.
> >
> > DoCmd.RunSQL "UPDATE [Tracking] SET [Tracking].[Contactperson] = '" & _
> >            Forms![frm Provider Tracking].[Contactperson] & "' WHERE
> > ([Tracking].[ID])= " & _
> >            Forms![frmPRTrckg].[ID]
> 
> 
> 
> Are "frm Provider Tracking" and "frmPRTrckg" supposed to be the same form? 
> If so, one of those names is wrong.
> 
> What parameter does it ask you for?
> 
> -- 
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
> 
> (please reply to the newsgroup)
> 
0
Utf
1/11/2008 6:29:01 PM
"TotallyConfused" <TotallyConfused@discussions.microsoft.com> wrote in 
message news:43F28153-8132-4903-A2FF-7C1EB65C7571@microsoft.com...
> Thank you.  Yes the forms name should be the same - fixed that.  But it is
> still prompting me for Contactperson.  What is wrong?
[...]
>> >
>> > DoCmd.RunSQL "UPDATE [Tracking] SET [Tracking].[Contactperson] = '" & _
>> >            Forms![frm Provider Tracking].[Contactperson] & "' WHERE
>> > ([Tracking].[ID])= " & _
>> >            Forms![frmPRTrckg].[ID]

Check to make sure that "Contactperson" is actually the name of the field in 
the Tracking table, and is spelled correctly.

-- 
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

0
Dirk
1/11/2008 6:34:24 PM
Thank you very much for your help.  The contactperson was misspelled.  Thank 
you

"Dirk Goldgar" wrote:

> "TotallyConfused" <TotallyConfused@discussions.microsoft.com> wrote in 
> message news:43F28153-8132-4903-A2FF-7C1EB65C7571@microsoft.com...
> > Thank you.  Yes the forms name should be the same - fixed that.  But it is
> > still prompting me for Contactperson.  What is wrong?
> [...]
> >> >
> >> > DoCmd.RunSQL "UPDATE [Tracking] SET [Tracking].[Contactperson] = '" & _
> >> >            Forms![frm Provider Tracking].[Contactperson] & "' WHERE
> >> > ([Tracking].[ID])= " & _
> >> >            Forms![frmPRTrckg].[ID]
> 
> Check to make sure that "Contactperson" is actually the name of the field in 
> the Tracking table, and is spelled correctly.
> 
> -- 
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
> 
> (please reply to the newsgroup)
> 
0
Utf
1/11/2008 6:50:01 PM
Reply:

Similar Artilces:

Duplicate messages ++++ HELP....
I am using Outlook 2002. Setup with one email account only as on offline user to 5.5 Exchange. When I do the send/receive via dial up I pull down whatever messages are on the Server down to the .PST file. Yet when I dial in again I get the same messages over and over. Again I only have one email account setup on the laptop. And it is setup to work offline with a .PST file. Everything I have read and found pertaining to this is if you have multiple acounts setup under the send/receive. This is not the case here. Getting tired of Microsofts constant change and lack of documentation of ...

function pointer help!
I have a callback function void __stdcall CallBackFunc(int, int,double); And I need to have a pointer to it. void (*CallBack)(int,int,double); but the assignment doesn't work... CallBack = CallBackFunc; What am I doing wrong? Thanks as usual! Ron H. ----------------- www.Newsgroup-Binaries.com - *Completion*Retention*Speed* Access your favorite newsgroups from home or on the road ----------------- Try this instead void (_stdcall *CallBack)(int,int,double); AliR. "Ron H." <rnh@mmm.com> wrote in message news:4739f338$0$7517$8d2e0cab@news.newsgroup-binaries.co...

Reason Code Report #2
I sell a perishable product, therefore I need to be able to track product that has perished. In the help menu, under reason codes, it states, the information is stored for use in tracking and reporting. That is why I chose this method to record dead plants. Now I need to know the cost and profit lost of these dead plants, as well, I don't want to purchase them again. So how do I get the information???? I read about a guy tracking dead fish by making the item inactive, although he was having trouble, should I change how I track this info for the future? I would greatly appreciate h...

count between dates help (NETWORKDAYS)
Hello big brains I am trying to find the days and hours between 2 dates 2 columns of dates formated in M/D/YYYY hh:mm 4/23/2004 15:53 and 4/27/2004 10:43 I don't want to count weekends so I used NETWORKDAYS which works to a degree.. giving me 3 (which is days) but it's ignoring the time. I need it to be specific and have it show days and hours difference. I am suprised that it is ignoring it. Unfortunately I am kind of stuck with the dat being in this format. Any help would be appreciated. thanks Maybe this can give you some ideas http://www.cpearson.com/excel/DateTimeWS.ht...

Function help needed urgently!!! #2
Hi anyone who can help... I have two sets of figures 1 is sales and 1 is target. Eg: Sales Target Incentive 5 5 In the Incentive column I want a formula that will calculate the Incentive payment for employees who exceed there target. The easy part is the if statement for example 10% of their sales if they exceed target: =if(sales>target,Sales*10%,0) The complicated part comes in to play when only when they hit multiples of 10 are they entitled to an incentive: If the Sales are 5 and the Target is 5 - no incentive. If the Sales are 10 and the Target is 5 - no incenti...

CDC Help!
One of the common shapes that seems to be missing from the CDC members is the arrow. Is there a good way to do arrows? I need to create arrows around the circumference of a circle pointing toward the center of the circle. Any hints on how this is best done? Ron H. ----------------- www.Newsgroup-Binaries.com - *Completion*Retention*Speed* Access your favorite newsgroups from home or on the road ----------------- I'm not sure if CDC has any line caps. In the past I used GDI+ to draw arrows and different kind of line caps. IMHO, the default line caps don't scale very well, so ...

Combobox Help needed
Hello, I have been trying to populate a Combobox with a filter set to what is being typed in the combo's edit control. If I type in "C" it selects the first 40 "C" then I would like to type in "u" clear the listbox portion and put in the first 40 "Cu" etc.. I would need to clear only the combo's edit box but unfortunately ResetContent()also clears the edit box. It gets the first 40 "C" but then the edit box is cleared. I have also tried using DeleteString. void CCustView::OnEditupdateCombo1() { UpdateData(); if (i>0) { m_CbCust....

An install code missing
This is a little perplexing .<br> <br> I was able to install Office for Mac on two of my Macs but the third code doesn't seem to want to work. (it's actually the one in the middle of the three install codes listed on my product box)<br> <br> Any idea why this might be so, and how can it be fixed? On 2/11/08 11:07 AM, in article ee8d064.-1@webcrossing.caR9absDaxw, "Bavanek@officeformac.com" <Bavanek@officeformac.com> wrote: > This is a little perplexing . > > I was able to install Office for Mac on two of my Macs but the third code >...

Form Size and Scroll Bars
Hello All, We have added a number of fields to the opportunity form. For some reason when the form loads the scroll bar goes all the way to the bottom of the form and the user has to scroll back up to the top of it. Any ideas why this might be happening? Thanks! Hi, Check out JScript in your onload event of opportunity. Is there any code which is moving the focuss to some field at bottom of form? -- PLEASE do click on Yes or No button if this post is helpful or not for our feedback. uMar Khan :: Freelance Consultant Email Contact :: imumar at gmail dot com "MDV1457" w...

Not sure why this code isn't working
Hello, I have a subform in Access 2003 with these fields, type of day, OLPEndDate, OLPBeginDate. At the end of each row, I want to calculate the total day taken for that particular vacation request, so if a person took 12/1/2009-12/2/2009 then the last field "TotalOLPTaken" should calculate as 1. What's happening is that it does calculate but all of the rows calculate to the same number. If I put the cursor in the second row and that row happens to have 12/4/2009-12/6/2009, then even the row with 12/1-12/2 calculates as 2. Then if I put the cursor back in the fi...

need some SQL Update Help
I have a Access 2000 db and I have these 2 tables. ArchInvoices --------------- InvoiceID - Primary Key - Autonumber InvoiceNumber - long SaleType - char(1) TransactionDate - DateTime Discount - Integer WholesaleFlag - Boolean PaymentMethod - Char(6) CustPONumber - Char(30) ShortName - Char(30) MdCountCode - char(2) TaxFreeID - char(30) Paid - Boolean FestInvoiceNumber - long The second Table is: ArchLineItems --------------- TransactionType - char(1) Units - integer UnitCost - Double BottleSize - Double LineItemId - PrimaryKey - Autonumber InvoiceNumber - Long - Foreign Key Field from Arc...

VLOOKUP help again please.
I have also finished my workbook. Now I am stumped on another vlookup function. Since some people dont like to download the file I will explain it in words and attach some screenshots. I need to use VLOOKUP and the discount table on the sheet 3 to calculate the relevant discount rate for the discount rate column in sheet 4. I have attempted it as you see in the screenshot, but it returns #NA. I am not sure if this is because my function is wrong or the discount table is set up wrong (I have entered the values such as "21 to 50", and im not sure if excel recognises this means from 2...

A simple question..help!!!
Ok, i'm trying to e-mail with Outlook....now can someone please tell me what the heck happened to the SEND button???? I have searched and searched for it. Where is it?? Please anyone help me out here. Thanks. Amy Hi Amy, which Outlook are you using? 2000?2003?XP? Did you create first of all an email account? Without email account outlook won't show a send button, I think. Or perhabs it is hidden on the toolbar? Greetings Steffi "fireeyesamy" <fireeyesamy@discussions.microsoft.com> wrote in message news:09522C66-14EA-4EB1-B3EB-151209810942@microsoft.com... > O...

Excel Crash
Multiple users here have this same problem that whenever they open a particular Excel file, it gives them a "Send Report Error." Weird thing about it is it doesnt happen in all their Excel files, only happens to some of them. Also tried opening the very same file/s they are having problems with on my machine and it worked fine. I have patched Office (SP2), updated Acrobat Reader, updated signatures, uninstalled/reinstalled Office, and done all the possible troubleshooting on these machines but still error occurs. Any help appreciated, thanks! Isolate the problem as best yo...

PLEASE HELP!!!!! MAcro Emergency
maybe now someone will help me?? noone has responded to my last 2 post so I am trying to figure it out myself, am trying to build a macro an need to select RELATIVE REFERENCE before I record it, that "sto recording" toolbar was there the first time i tried to record the macr with the button to select relative reference but now every time i try t record the macro that toolbar isnt there anymore and the macro wont wor unless i can first select relative reference, please help before i tak the sledge to this computer PLEASE!! -- RalphS -------------------------------------------------...

Help required on working with date
Hi I have dates in a column in dd-mmm-yy format, like 29-Mar-04 15-Apr-04 13-May-04 I want to put in the column adjecent to this date column the date starting with 1st day of each month like - 01-Mar-04 01-Apr-04 01-May-04 How can this be done by use of formula? I tried but do not get any clue to go futher. -Shanks Hi try =DATE(YEAR(A1),MONTH(A1),1) -- Regards Frank Kabel Frankfurt, Germany Shanks wrote: > Hi > > I have dates in a column in dd-mmm-yy format, like > > 29-Mar-04 > 15-Apr-04 > 13-May-04 > > I want to put in the column adjecent to this da...

execute FireOnChange() from another Form
can i execute a FireOnChange event on a field from a another form? For example: In the OnSave() event from QuoteProduct form, execute the FireOnChange() event of the totalamount field in the Quote Form Thanks Enrique This is not support "out of box". Try Server SDK, pre/post callouts. Frank Lee Workopia, Inc. http://www.workopia.com/Links.htm "Enrique Bravo" wrote: > can i execute a FireOnChange event on a field from a another form? > > For example: > In the OnSave() event from QuoteProduct form, execute the FireOnChange() > event of the totalamoun...

Form Name as Variable
Hi, I have the following subroutine: Public Sub SetMeterBasic(p As Single) ' This subprocedure is used to update the progress meter bar With Forms![FormA] .shpMeterBar.Width = p * .lblMeter.Width .lblMeter.Caption = Format(p, "##%") .Repaint End With End Sub FormA is a form from which I called the main subroutine of the program which then later called this procedure. Is there a way I can pass a form name to Sub SetMeter e.g. so its first line is Public Sub SetMeterBasic(p As Single, FormName as String) where the variable FormName can function as &...

Create Table in code
Hello all, I need to create a table in code with dynamics columns. Anyone do this before? can i see a sample many thanx DAO is best for creating tables. Here's an example showing the various field types and properties: http://allenbrowne.com/func-DAO.html#CreateTableDAO It is also possible to use ADOX: http://allenbrowne.com/func-ADOX.html#CreateTableAdox Or you could use DDL: http://allenbrowne.com/func-DDL.html#CreateTableDDL -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than ...

Help with VC6.0 Basic Concept!
Hello everyone, I am new to VC,and I don't quit understand the defferences in project types in vc6.0, especially MFC AppWizard, Win32 Application, Win32 Console Application, Win32 Dynamic-Link Libray, MFC AppWizard and Win32 Static Libary,Thanks very much! Lazytiger wrote: > Hello everyone, > I am new to VC,and I don't quit understand the defferences in project > types in vc6.0, especially MFC AppWizard, Win32 Application, Win32 Console > Application, Win32 Dynamic-Link Libray, MFC AppWizard and Win32 Static > Libary,Thanks very much! A console applic...

Distribution List Help
Hi, We are using Exchange 5.5. We have a distribution list called "jobs@xyz.com". E-mail address is available on our company website. Now, we are planning to change this address to something else. We want to send an auto-reply to all e-mails coming on "jobs@xyz.com" saying that "Please visit our website to find new e-mail address and re-send the message". One reason to do this way is, we want to stop spam e-mails coming on this address but we really want to get good e-mails. I hope I have made my case clear enogh. Any help would be appreciated. Thanks Kirtan...

Form fields vs. document properties
I'm creating common templates for multiple dealers of the same product. For example, one dealer may open my "Client Guide" document and all he needs to do is update approximately 20 fields and he is done. I'm using the standard document properties fields for my company information, but there are 10+ more unique fields I need to do this for. I've been trying all night to use quick parts, building blocks, etc. to accomplish this but I am really struggling. I can use a fill-in field, but it prompts for the field every place I use it. I've enabled th...

default appointment times problems
When i re-open outlook and go to the calender, all the appointments times have changed to 1am on the start day - 1am on the day after it waqs meant to finish. So a 12 day appointment is now shown as over 2 days. How do you change the default appointment time settings so an appointment which is just typed into the day is from 9am - 5pm for example and will stay as a 1 day event when opening and closing outlook? All day events are 12 -12, not 9-5. If you want it 9-5, you need to make it for 9-5. All day appointment change to 1 -1 if you change the time zone or DST settings aft...

In Excel I need to insert a clean form each use
I have created a protected worksheet with unlocked cells to be filled in by the user and saved. Then next week I need to to have another copy of the same blank form for the user to fill in with new data. I thought I could just insert a copy of the form (as its own file) on Sheet 1, but can't figure out how to do that. Robin, Hold down the CTRL key, left click the sheet tab and drag to create a copy. It will have a name of something like Sheet1 (2) so rename as required. Mike "Robin" wrote: > I have created a protected worksheet with unlocked cells to ...

help with pivot tables
I have created a spreadsheet which has multiple pivot tables the only problem is that my source data can contain anything from one item to fifty items therefore the pivot tables can overlap if two adjoining pivot table both contain alot of information, how do I solve this problem I want the pivot table when refreshed to insert and move everthing else either down or across plese help ...