Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Append/Add Record in View - Blank key field in table
Message
From
23/07/1999 14:56:44
 
 
To
23/07/1999 14:33:53
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00245336
Message ID:
00245492
Views:
22
Sometimes the view builder does a poor job of setting up the view code. Now that you've got the code, why don't you use it. Make the change as I've done below making all the fields updatable.


>What a mess. Sorry, I didn't take my own advice.
>
>>Lets just look at this part of the code.
>>
>><br>>>Just to let you know. If you surround your code with a<pre class=Code> <span class='vfpreserved'>tag</span> it will preserve the tabbing. >>&lt;/XMP> >>> >> >> >> &lt;pre> >>><span class='vfpreserved'>select</span> (tcTableName) >>><span class='vfpreserved'>dime</span> aFlds(<span class='vfpliteral'>1</span>) >>>nNoFields = <span class='vfpreserved'>afield</span>(aFlds) >>> >>><span class='vfpreserved'>for</span> lnKnt = <span class='vfpliteral'>1</span> <span class='vfpreserved'>to</span> nNoFields >>> lcFieldName = tcViewName + <span class='vfpstring'>"."</span> + aFlds(lnKnt,<span class='vfpliteral'>1</span>) >>> lcUpdateField = tcTableName + <span class='vfpstring'>"."</span> + aFlds(lnKnt,<span class='vfpliteral'>1</span>) >>> lcFieldType = aFlds(lnKnt,<span class='vfpliteral'>2</span>) + ; >>> <span class='vfpstring'>"("</span> + <span class='vfpreserved'>alltrim</span>(<span class='vfpreserved'>str</span>(aFlds >> >>It looks <span class='vfpreserved'>like</span> here that the keyfield <span class='vfpreserved'>is</span> not <span class='vfpreserved'>updatable</span> but the <span class='vfpreserved'>rest</span> are. >>I thinks you want <span class='vfpreserved'>all</span> <span class='vfpreserved'>of</span> your <span class='vfpreserved'>fields</span> <span class='vfpreserved'>updatable</span>. >> >>(lnKnt,<span class='vfpliteral'>3</span>)) + <span class='vfpstring'>")"</span> ) >>> <span class='vfpreserved'>if</span> aFlds(lnKnt,<span class='vfpliteral'>1</span>) = cIDField >>> <span class='vfpreserved'>DBSetProp</span>(lcFieldName, <span class='vfpstring'>'Field'</span>, <span class='vfpstring'>'KeyField'</span>, .t.) Changed <span class='vfpreserved'>this</span> lin >>> <span class='vfpreserved'>DBSetProp</span>(lcFieldName, <span class='vfpstring'>'Field'</span>, <span class='vfpstring'>'Updatable'</span>, .t.) >>> <span class='vfpreserved'>else</span> >>> <span class='vfpreserved'>DBSetProp</span>(lcFieldName, <span class='vfpstring'>'Field'</span>, <span class='vfpstring'>'KeyField'</span>, .f.) >>> <span class='vfpreserved'>DBSetProp</span>(lcFieldName, <span class='vfpstring'>'Field'</span>, <span class='vfpstring'>'Updatable'</span>, .t.) >>> <span class='vfpreserved'>endif</span> >>> <span class='vfpreserved'>DBSetProp</span>(lcFieldName, <span class='vfpstring'>'Field'</span>, <span class='vfpstring'>'UpdateName'</span>, lcUpdateField) >>> <span class='vfpreserved'>DBSetProp</span>(lcFieldName, <span class='vfpstring'>'Field'</span>, <span class='vfpstring'>'DataType'</span>, lcFieldType) >>><span class='vfpreserved'>endfor</span> >> ></pre>>>HTH<br>>><br>Dan <style> .Signature { margin-top: 12px; color: #666666; } .Signature a { color: #666666; } </style> </div><div style="margin-top: 12px;"></div><div class="DivWrapper" style="text-align: center; width: 100%;"><a href="https://www.levelextreme.com/Home/ViewPage?Activator=1021&ID=245467" title="View the parent message of this message"><div class="Button ButtonDataEntry">Previous</div></a><a href="https://www.levelextreme.com/Home/ViewPage?Activator=1021&ID=247864" title="View the first child message of this message"><div class="Button ButtonDataEntry">Next</div></a><a href="https://www.levelextreme.com/Home/DataEntry?Activator=185&NoThread=245492" title="Reply to this message"><div class="Button ButtonDataEntry">Reply</div></a><a href="javascript:HamburgerMenu('Hamburger4','Caret4','ButtonDropDown4',false)" title=""><div class="Button ButtonDataEntry" id="ButtonDropDown4">Map<div class="Caret" id="Caret4"></div></div></a><div class="Hamburger" id="Hamburger4" style="display: none;"> <div class="HamburgerItem HamburgerItemFirst" onclick="HamburgerMenuSelected('https://www.levelextreme.com/Home/SupportArea?Process=45&Numero=245336',parent.FRAMERMAP,4)">View the map of this thread</div><div class="HamburgerItem HamburgerItemFollow" onclick="HamburgerMenuSelected('https://www.levelextreme.com/Home/SupportArea?Process=46&Numero=245492',parent.FRAMERMAP,4)">View the map of this thread starting from this message only</div></div> <a href="javascript:HamburgerMenu('Hamburger5','Caret5','ButtonDropDown5',false)" title=""><div class="Button ButtonDataEntry" id="ButtonDropDown5">View<div class="Caret" id="Caret5"></div></div></a><div class="Hamburger" id="Hamburger5" style="display: none;"> <div class="HamburgerItem HamburgerItemFirst" onclick="HamburgerMenuSelected('https://www.levelextreme.com/Home/SupportArea?Process=48&Numero=245336',parent.MESSAGE,5)">View all messages of this thread</div><div class="HamburgerItem HamburgerItemFollow" onclick="HamburgerMenuSelected('https://www.levelextreme.com/Home/SupportArea?Process=49&Numero=245492',parent.MESSAGE,5)">View all messages of this thread starting from this message only</div></div> </div></div></div></div></div><p> <center> <a href="https://www.levelextreme.com/Home/ViewPageGeneric?Activator=1&NoThread=245492" class="Button"> Click here to load this message in the networking platform </a> </center> <iframe name="IFrameTransaction" id="IFrameTransaction" frameborder="0" width="0" height="0" scrolling="no" allowTransparency="true" style="display: none; margin: 0px;"></iframe> </div></div></div></div><div class="Footer" id="Footer"><div class="Footer2"><span id="Span"><div style="display: table;"><div style="display: inline-table; vertical-align: middle; margin-left: 50px; margin-right: 50px; "><div class="ItemColumn"><div class="Item2">Level Extreme platform</div><div class="ItemSubItem2"><a href="https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=50&Menu=114&SubMenu=50">Best practices</a></div><div class="ItemSubItem2"><a href="https://www.levelextreme.com/Home/ShowHeader?Activator=14&Menu=114&SubMenu=69">Testimonials</a></div><div class="ItemSubItem2"><a href="https://www.levelextreme.com/Home/ShowHeader?Activator=2&Menu=114&SubMenu=75">Downloads</a></div><div class="ItemSubItem2"><a href="https://www.levelextreme.com/Home/ShowHeader?Activator=3&Menu=114&SubMenu=76">Articles</a></div><p><div class="Item2">Subscription</div><div class="ItemSubItem2"><a href="https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303&Menu=73&SubMenu=141">Subscribe or renew</a></div><div class="ItemSubItem2"><a href="https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52&Menu=73&SubMenu=52">Benefits</a></div><div class="ItemSubItem2"><a href="https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=3004&Menu=73&SubMenu=131">Donate 5$</a></div><div class="ItemSubItem2"><a href="https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=3005&Menu=73&SubMenu=127">Donate 10$</a></div><div class="ItemSubItem2"><a href="https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=3006&Menu=73&SubMenu=128">Donate 15$</a></div><div class="ItemSubItem2"><a href="https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=3007&Menu=73&SubMenu=129">Donate 20$</a></div><div class="ItemSubItem2"><a href="https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=3008&Menu=73&SubMenu=130">Donate 25$</a></div><p><div class="Item2">Corporate profile</div><div class="ItemSubItem2"><a href="https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=1&Menu=151&SubMenu=1&Menu=151&SubMenu=1">Overview</a></div><div class="ItemSubItem2"><a href="https://www.levelextreme.com/Home/ShowHeader?Activator=15&Menu=151&SubMenu=138">Portfolio</a></div><p><div class="Item2">Products & Services</div><div class="ItemSubItem2"><a href="https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=125&Menu=118&SubMenu=125&Menu=118&SubMenu=125">Consulting services</a></div><div class="ItemSubItem2"><a href="https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=51&Menu=118&SubMenu=51">Enterprise hosting</a></div><div class="ItemSubItem2"><a href="https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=49&Menu=118&SubMenu=49">Web Site Hosting</a></div><div class="ItemSubItem2"><a href="https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=135&Menu=118&SubMenu=135">Graphic design</a></div><div class="ItemSubItem2"><a href="https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=121&Menu=118&SubMenu=121">Book publishing</a></div><p><div class="Item2">Support</div><div class="ItemSubItem2"><a href="https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=66&Menu=120&SubMenu=66">Troubleshooting</a></div><div class="ItemSubItem2"><a href="https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=65&Menu=120&SubMenu=65">Problem with logins</a></div><div class="ItemSubItem2"><a href="https://www.levelextreme.com/Home/ViewPage?Activator=14&Menu=120&SubMenu=68">Contact us</a></div><p><div class="Item2">Legal</div><div class="ItemSubItem2"><a href="https://www.levelextreme.com/Home/ViewPage?Activator=15&Menu=117&SubMenu=70">Copyright</a></div><div class="ItemSubItem2"><a href="https://www.levelextreme.com/Home/ViewPage?Activator=11&Menu=117&SubMenu=71">Privacy policy</a></div><div class="ItemSubItem2"><a href="https://www.levelextreme.com/Home/ViewPage?Activator=12&Menu=117&SubMenu=72">Terms & Conditions</a></div><p><div class="Item2"><a href="https://www.levelextreme.com/Home/Login?Manual=1">Login</a></div><div class="Item2"><a href="Home/ViewPageGeneric?Activator=1012">Google</a></div></div><div class="FooterLower">Copyright © 1993-2024 by Level Extreme Inc. All rights reserved · Website by <a href="https://www.levelextreme.com">levelextreme.com</A></div></div><div style="display: inline-table; vertical-align: middle;"></div></div></span></div></div> </body> </html> <script> function RemoveChild() { if (oDiv) { if (typeof parent.frames['IFrameTransaction'].OnUnload==="function") { parent.frames['IFrameTransaction'].OnUnload() } oDiv.parentNode.removeChild(oDiv) oDiv='' } } function WindowKeyPress(toEvent) { var lnKey lnKey=GetKey() if (lnKey==27) { if (window.event) { window.event.keyCode=0 } else { if (toEvent) { if (toEvent.keyCode) { toEvent.keyCode=0 } else { toEvent.charCode=0 } } else { } } if (window.event) { event.returnValue=false } else { toEvent.preventDefault() } RemoveChild() } } function GetKey(toEvent) { var lnKey if (window.event) { lnKey=window.event.keyCode } else { if (toEvent) { if (toEvent.keyCode) { lnKey=toEvent.keyCode } else { lnKey=toEvent.charCode } } else { } } return lnKey } // Enable support for Mozilla if (document.layers) { document.captureEvents(Event.KEYPRESS) } function ReturnOffsetX(toObj) { lnOffset=0 loObj=toObj if (loObj) { if (loObj.offsetParent) { while (loObj.offsetParent) { lnOffset=lnOffset+loObj.offsetLeft loObj=loObj.offsetParent } } } return lnOffset } function ReturnOffsetY(toObj) { lnOffset=0 loObj=toObj if (loObj) { if (loObj.offsetParent) { while (loObj.offsetParent) { lnOffset=lnOffset+loObj.offsetTop loObj=loObj.offsetParent } } } return lnOffset } function Collapse(tcDiv,tcClass) { var lcClass var loDiv var loDiv2 lcClass="Caret" if (tcClass) { lcClass=tcClass } loDiv=document.getElementById(tcDiv) loDiv2=document.getElementById("Caret"+tcDiv) if (loDiv.style.display=="none") { loDiv.style.display="" loDiv2.className=lcClass+"Up" } else { loDiv.style.display="none" loDiv2.className=lcClass } if (typeof(CollapseClient) != "undefined") { CollapseClient() } } function ExpandAll(tlExpand) { var lcMessage,lcMessageId lcMessage=document.Search.TreeView.value while (lcMessage.length>1) { lcMessageId=lcMessage.substr(0,6) lcMessage=lcMessage.substr(7) if (tlExpand) { document.getElementById(lcMessageId).style.display="" document.getElementById(lcMessageId+'Image').src=img1.src } else { document.getElementById(lcMessageId).style.display="none" document.getElementById(lcMessageId+'Image').src=img2.src } } } function HamburgerMenu(tcDiv,tcDivCaret,tcDivParent,tlMaxWidthToParent) { for (lnCounter=0; lnCounter<20; lnCounter++) { if (tcDiv!='Hamburger'+(lnCounter+1)) { loDiv=document.getElementById('Hamburger'+(lnCounter+1)) if (loDiv) { if (loDiv.style.display=="") { loDiv.style.display="none" loDiv=document.getElementById('Caret'+(lnCounter+1)) loDiv.className="Caret" } } } } loDiv=document.getElementById(tcDiv) if (tcDivParent) { loDivParent=document.getElementById(tcDivParent) lnLeft=ReturnOffsetX(loDivParent) lnTop=ReturnOffsetY(loDivParent) lnTop=lnTop+30 lnLeft=lnLeft-2 loDiv.style.left=lnLeft+"px" loDiv.style.top=lnTop+"px" if (tlMaxWidthToParent) { loDiv.style.width=(loDivParent.clientWidth+2)+"px" } } loDiv2=document.getElementById(tcDivCaret) if (loDiv.style.display=="") { loDiv.style.display="none" loDiv2.className="Caret" } else { loDiv.style.display="" loDiv2.className="CaretUp" } } function HamburgerMenuSelected(tcUrl,toWindow,tcID,tcJavascript) { loDiv=document.getElementById("Hamburger"+tcID) loDiv.style.display="none" loDiv=document.getElementById("Caret"+tcID) loDiv.className="Caret" if (tcUrl.length>0) { if (toWindow) { toWindow.location.href=tcUrl } else { document.location.href=tcUrl } } else { eval(tcJavascript) } } oDiv='' oParent='' lnNumero=245492 function ThisOptionRequireSubscription() { if (confirm("A subscription is required to access this option. Would you like to subcribe now?")) { window.open("https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303","_blank") } } function ContainerCollapse() { var loDiv loDiv=document.getElementById('ContainerLeft') if (loDiv.style.display=="none") { loDiv.style.display="" } else { loDiv.style.display="none" } } </script>