If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Newby question about code
Does it matter if code syntax or entries are changed (or typed over) after
the fact? Is the function thereby altered or disrupted? For example, if I change the table name in: If Val(DLookup("[Level]", "tblUsers", "[UserID]='" & CurrentUser() & "'")) = 2 Then boxDCMgt.Visible = False Else boxDCMgt.Visible = True End If to: If Val(DLookup("[Level]", "004UserAuth_tbl", "[UserID]='" & CurrentUser() & "'")) = 2 Then boxDCMgt.Visible = False Else boxDCMgt.Visible = True End If will the code still work? Or if I add Me. to my boxes after the code is already written: If Val(DLookup("[Level]", "004UserAuth_tbl", "[UserID]='" & CurrentUser() & "'")) = 2 Then Me.boxDCMgt.Visible = False Else Me.boxDCMgt.Visible = True End If should that have any effect? Thanks for your time!! -- GD |
#2
|
|||
|
|||
Newby question about code
Since the code is interpreted at runtime, then when you make changes the
changes take place. Well, the code is interpreted at runtime unless it has been compiled. If it has been compiled (and not changed) the story is slightly different. BUT, when you make a change the compiled code for that procedure is ignored and the code is interpreted. So if you change the code, you change the behavior. John Spencer Access MVP 2002-2005, 2007-2009 The Hilltop Institute University of Maryland Baltimore County GD wrote: Does it matter if code syntax or entries are changed (or typed over) after the fact? Is the function thereby altered or disrupted? For example, if I change the table name in: If Val(DLookup("[Level]", "tblUsers", "[UserID]='" & CurrentUser() & "'")) = 2 Then boxDCMgt.Visible = False Else boxDCMgt.Visible = True End If to: If Val(DLookup("[Level]", "004UserAuth_tbl", "[UserID]='" & CurrentUser() & "'")) = 2 Then boxDCMgt.Visible = False Else boxDCMgt.Visible = True End If will the code still work? Or if I add Me. to my boxes after the code is already written: If Val(DLookup("[Level]", "004UserAuth_tbl", "[UserID]='" & CurrentUser() & "'")) = 2 Then Me.boxDCMgt.Visible = False Else Me.boxDCMgt.Visible = True End If should that have any effect? Thanks for your time!! |
#3
|
|||
|
|||
Newby question about code
On Thu, 8 Jan 2009 08:26:45 -0800, GD wrote:
Does it matter if code syntax or entries are changed (or typed over) after the fact? Is the function thereby altered or disrupted? You should always use Debug... Compile after making changes; correct any errors that the compiler discovers; and save the project with the diskette icon on the toolbar - but no, the reason that VBA has a code editor window is that they assume you'll be editing your code! -- John W. Vinson [MVP] |
#4
|
|||
|
|||
Newby question about code
Also keeping in mind that, in the case of DLookup() and other functions of
its ilk, the syntax for the Criteria argument changes slightly, depending on the Datatype. "[UserID]='" & CurrentUser() & "'" will work because CurrentUser() returns a Text field, but if you substitute another type of field here, such as a Numeric or Date/Time field the code would fail. -- There's ALWAYS more than one way to skin a cat! Answers/posts based on Access 2000/2003 Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...arted/200901/1 |
#5
|
|||
|
|||
Newby question about code
GD wrote:
If Val(DLookup("[Level]", "tblUsers", "[UserID]='" & CurrentUser() & "'")) = 2 Then to: If Val(DLookup("[Level]", "004UserAuth_tbl", "[UserID]='" & CurrentUser() & "'")) = 2 Then Now why would you want to put a 004 in front of the table name? This sounds like it might violate normalizing recommendations/rules. Tony -- Tony Toews, Microsoft Access MVP Please respond only in the newsgroups so that others can read the entire thread of messages. Microsoft Access Links, Hints, Tips & Accounting Systems at http://www.granite.ab.ca/accsmstr.htm Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/ |
Thread Tools | |
Display Modes | |
|
|