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 |
#11
|
|||
|
|||
Time stamp for user audit
Steve, I was mucking around with this last eve and I have the code validated,
but on the form, no data is being returned. I am getting $Name# in the UserID field? Steve Sanford wrote: I paste in code alot during testing and I forgot to tell you how to "hook up" the code to the form. When you paste code for an event in the IDE, the code is not connected to the form event. So when you paste in the "Form_Load()" code, you have to: - open the form in design view, - show the properties dialog for the form, - click on the "EVENTS" tab, - make sure that the On Load property shows "[Event Procedure]", - then click on the elipis (...). It should open the IDE to the form load code you just pasted in the code page. HTH OK, I have resolved the initial issue with this code ; ), but now I am getting an error on the subform that reads "Method or data member not found" [quoted text clipped - 15 lines] record, even if you're only looking at it or simply passing thru it on the way to another record, using the navigation arrows. -- Message posted via http://www.accessmonster.com |
#12
|
|||
|
|||
Time stamp for user audit
Is the text box (UserID) on the hidden form an unbound control? The hidden
form should also be unbound. You can open the module "UserComputer" click anywhere in the Function GetCurrentUserName() code. Step thru the code one line at a time (the {F8} key) to see what is happening in the code. Be sure and have the "Locals Window" (menubar/VIEW) visible to see what is in the variables. If the correct user ID is seen, the problem is somewhere else. Open the IDE to the (hidden) form open code and set a breakpoint on the line Me.UserID = GetCurrentUserName() Change the form from design view to form view. Use the {F8} key to step thru the code. The ides is that the hidden form has an unbound text box that holds the user ID. Whenever you want to get the user ID to you would use Forms![YourHiddenformName].UserID to get the user ID. HTH -- Steve S -------------------------------- "Veni, Vidi, Velcro" (I came; I saw; I stuck around.) "craigcole5 via AccessMonster.com" wrote: Steve, I was mucking around with this last eve and I have the code validated, but on the form, no data is being returned. I am getting $Name# in the UserID field? Steve Sanford wrote: I paste in code alot during testing and I forgot to tell you how to "hook up" the code to the form. When you paste code for an event in the IDE, the code is not connected to the form event. So when you paste in the "Form_Load()" code, you have to: - open the form in design view, - show the properties dialog for the form, - click on the "EVENTS" tab, - make sure that the On Load property shows "[Event Procedure]", - then click on the elipis (...). It should open the IDE to the form load code you just pasted in the code page. HTH OK, I have resolved the initial issue with this code ; ), but now I am getting an error on the subform that reads "Method or data member not found" [quoted text clipped - 15 lines] record, even if you're only looking at it or simply passing thru it on the way to another record, using the navigation arrows. -- Message posted via http://www.accessmonster.com |
#13
|
|||
|
|||
Time stamp for user audit
on the line Me.UserID = GetCurrentUserName(), the .UserID becomes highlighted
in blue and the Private Sub Form_Load() above this line is yellow. I truely appriciate your help and knowledge on this subject. Steve Sanford wrote: Is the text box (UserID) on the hidden form an unbound control? The hidden form should also be unbound. You can open the module "UserComputer" click anywhere in the Function GetCurrentUserName() code. Step thru the code one line at a time (the {F8} key) to see what is happening in the code. Be sure and have the "Locals Window" (menubar/VIEW) visible to see what is in the variables. If the correct user ID is seen, the problem is somewhere else. Open the IDE to the (hidden) form open code and set a breakpoint on the line Me.UserID = GetCurrentUserName() Change the form from design view to form view. Use the {F8} key to step thru the code. The ides is that the hidden form has an unbound text box that holds the user ID. Whenever you want to get the user ID to you would use Forms![YourHiddenformName].UserID to get the user ID. HTH Steve, I was mucking around with this last eve and I have the code validated, but on the form, no data is being returned. I am getting $Name# in the UserID [quoted text clipped - 20 lines] record, even if you're only looking at it or simply passing thru it on the way to another record, using the navigation arrows. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200908/1 |
#14
|
|||
|
|||
Time stamp for user audit
The only way I can get the .UserID to become highlighted in blue and the
Private Sub Form_Load() to yellow is when the text box name is not "UserID". Check the name of the text box. HTH -- Steve S -------------------------------- "Veni, Vidi, Velcro" (I came; I saw; I stuck around.) "craigcole5 via AccessMonster.com" wrote: on the line Me.UserID = GetCurrentUserName(), the .UserID becomes highlighted in blue and the Private Sub Form_Load() above this line is yellow. I truely appriciate your help and knowledge on this subject. Steve Sanford wrote: Is the text box (UserID) on the hidden form an unbound control? The hidden form should also be unbound. You can open the module "UserComputer" click anywhere in the Function GetCurrentUserName() code. Step thru the code one line at a time (the {F8} key) to see what is happening in the code. Be sure and have the "Locals Window" (menubar/VIEW) visible to see what is in the variables. If the correct user ID is seen, the problem is somewhere else. Open the IDE to the (hidden) form open code and set a breakpoint on the line Me.UserID = GetCurrentUserName() Change the form from design view to form view. Use the {F8} key to step thru the code. The ides is that the hidden form has an unbound text box that holds the user ID. Whenever you want to get the user ID to you would use Forms![YourHiddenformName].UserID to get the user ID. HTH Steve, I was mucking around with this last eve and I have the code validated, but on the form, no data is being returned. I am getting $Name# in the UserID [quoted text clipped - 20 lines] record, even if you're only looking at it or simply passing thru it on the way to another record, using the navigation arrows. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200908/1 |
#15
|
|||
|
|||
Time stamp for user audit
verified. One thing I do notice is that within the body of code, the me.
UserID is in all lowercase and I can not change it to read me.UserID. Not sure if this makes a difference ans causing the issue? Steve Sanford wrote: The only way I can get the .UserID to become highlighted in blue and the Private Sub Form_Load() to yellow is when the text box name is not "UserID". Check the name of the text box. HTH on the line Me.UserID = GetCurrentUserName(), the .UserID becomes highlighted in blue and the Private Sub Form_Load() above this line is yellow. I truely [quoted text clipped - 30 lines] record, even if you're only looking at it or simply passing thru it on the way to another record, using the navigation arrows. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200908/1 |
#16
|
|||
|
|||
Time stamp for user audit
OK, just to recap:
In a standard module (I named it UserComputer) you have these declarations: Option Compare Database Option Explicit Private Declare Function GetComputerNameA Lib "kernel32" (ByVal lpBuffer As String, nSize As Long) As Long Private Declare Function GetUserName Lib "ADVAPI32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long and these two functions: Public Function GetComputerName() As String Public Function GetCurrentUserName() As String On the form that is to stay hidden, you have a text box named UserID. On this same form (the hidden form) you have this code: '--------------------------- Private Sub Form_Load() Me.UserID = GetCurrentUserName() DoCmd.OpenForm "YourStartUpFormName" 'change to your form End Sub '--------------------------- and you have opened the form's property dialog and clicked on the "On Load" property. This shows "[Event Procedure]" and you clicked on the elipis (...) and can see the code? In the IDE, have you tried compiling the code? (Menu bar/DEBUG/COMPILE) Any errors??? HTH -- Steve S -------------------------------- "Veni, Vidi, Velcro" (I came; I saw; I stuck around.) "craigcole5 via AccessMonster.com" wrote: verified. One thing I do notice is that within the body of code, the me. UserID is in all lowercase and I can not change it to read me.UserID. Not sure if this makes a difference ans causing the issue? Steve Sanford wrote: The only way I can get the .UserID to become highlighted in blue and the Private Sub Form_Load() to yellow is when the text box name is not "UserID". Check the name of the text box. HTH on the line Me.UserID = GetCurrentUserName(), the .UserID becomes highlighted in blue and the Private Sub Form_Load() above this line is yellow. I truely [quoted text clipped - 30 lines] record, even if you're only looking at it or simply passing thru it on the way to another record, using the navigation arrows. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200908/1 |
#17
|
|||
|
|||
Time stamp for user audit
I have and receive the same compile error:
Private Sub Form_Load() (yellow) .userid = GetCurrentUserName() (blue) DoCmd.OpenForm "Form1" "My form name" End Sub Steve Sanford wrote: OK, just to recap: In a standard module (I named it UserComputer) you have these declarations: Option Compare Database Option Explicit Private Declare Function GetComputerNameA Lib "kernel32" (ByVal lpBuffer As String, nSize As Long) As Long Private Declare Function GetUserName Lib "ADVAPI32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long and these two functions: Public Function GetComputerName() As String Public Function GetCurrentUserName() As String On the form that is to stay hidden, you have a text box named UserID. On this same form (the hidden form) you have this code: '--------------------------- Private Sub Form_Load() Me.UserID = GetCurrentUserName() DoCmd.OpenForm "YourStartUpFormName" 'change to your form End Sub '--------------------------- and you have opened the form's property dialog and clicked on the "On Load" property. This shows "[Event Procedure]" and you clicked on the elipis (...) and can see the code? In the IDE, have you tried compiling the code? (Menu bar/DEBUG/COMPILE) Any errors??? HTH verified. One thing I do notice is that within the body of code, the me. UserID is in all lowercase and I can not change it to read me.UserID. Not [quoted text clipped - 11 lines] record, even if you're only looking at it or simply passing thru it on the way to another record, using the navigation arrows. -- Message posted via http://www.accessmonster.com |
#18
|
|||
|
|||
Time stamp for user audit
I have and receive the same compile error: Private Sub Form_Load() (yellow) .userid = GetCurrentUserName() (blue) DoCmd.OpenForm "Form1" "My form name" End Sub I made a new MDB and created new forms, the module and pasted in the code. I do not have any errors or problems. In your code above, you are missing the "Me" in front of ".UserID". Delete your sub, and paste in the following: '--------------------------- Private Sub Form_Load() Me.UserID = GetCurrentUserName() DoCmd.OpenForm "Form1" End Sub '--------------------------- Save it and compile the code. In an earlier post, you said "I already have a startup form that is visible to the users". Is that form named "Form1"?? What is the name of the hidden form? HTH -- Steve S -------------------------------- "Veni, Vidi, Velcro" (I came; I saw; I stuck around.) |
#19
|
|||
|
|||
Time stamp for user audit
The Me is in place, I was just showing the portion of the code that is
highlighted. The name of my visible form is Form1 and the invisible forms title is UserID. I did delete and entered the code again previously to your suggestion, same outcome. Regards, Craig Steve Sanford wrote: I have and receive the same compile error: Private Sub Form_Load() (yellow) .userid = GetCurrentUserName() (blue) DoCmd.OpenForm "Form1" "My form name" End Sub I made a new MDB and created new forms, the module and pasted in the code. I do not have any errors or problems. In your code above, you are missing the "Me" in front of ".UserID". Delete your sub, and paste in the following: '--------------------------- Private Sub Form_Load() Me.UserID = GetCurrentUserName() DoCmd.OpenForm "Form1" End Sub '--------------------------- Save it and compile the code. In an earlier post, you said "I already have a startup form that is visible to the users". Is that form named "Form1"?? What is the name of the hidden form? HTH -- Message posted via http://www.accessmonster.com |
#20
|
|||
|
|||
Time stamp for user audit
Craig,
At this point I am at a loss. The code runs without an error on my computer (Win XP/A2K/A2K3). I have a form named "frmHidden". It has a text box named "UserID". I added the code. I have a form named "Form1". I set the STARTUP option to open "frmHidden" (but visible) when Access start. My userID is in the text box - no errors... and "Form1" opens. Try creating a new "Test" mdb. Import the standard module. Create two new forms - don't import them. On the hidden form, add the text box and the form open code. On Form1, put any control you want - just so it has something on it. Set it up so that when the mdb opens, it opens the hidden form. If it *still* doesn't work, (if you want) do a compile and repair, and email it (the test mdb) to me (in A2K or A2K3 format). I will look at it tonight... HTH -- Steve S -------------------------------- "Veni, Vidi, Velcro" (I came; I saw; I stuck around.) "craigcole5 via AccessMonster.com" wrote: The Me is in place, I was just showing the portion of the code that is highlighted. The name of my visible form is Form1 and the invisible forms title is UserID. I did delete and entered the code again previously to your suggestion, same outcome. Regards, Craig Steve Sanford wrote: I have and receive the same compile error: Private Sub Form_Load() (yellow) .userid = GetCurrentUserName() (blue) DoCmd.OpenForm "Form1" "My form name" End Sub I made a new MDB and created new forms, the module and pasted in the code. I do not have any errors or problems. In your code above, you are missing the "Me" in front of ".UserID". Delete your sub, and paste in the following: '--------------------------- Private Sub Form_Load() Me.UserID = GetCurrentUserName() DoCmd.OpenForm "Form1" End Sub '--------------------------- Save it and compile the code. In an earlier post, you said "I already have a startup form that is visible to the users". Is that form named "Form1"?? What is the name of the hidden form? HTH -- Message posted via http://www.accessmonster.com |
|
Thread Tools | |
Display Modes | |
|
|