Load event question

I found this code along with it's function on this discussion group. It works 
great but I want it to populate the text field when the form loads.
How can I get the following code on the Form_Load()? 
fOSUserName() is a defined function.

Private Sub Form_BeforeUpdate(Cancel As Integer)
    On Error GoTo BeforeUpdate_Err

    ' Set bound controls to system date and time and current user name
    Me.DateModified = Now()
    Me.ModifiedBy = fOSUserName()

BeforeUpdate_End:
    Exit Sub
BeforeUpdate_Err:
    MsgBox Err.Description, vbCritical & vbOKOnly, _
        "Error Number " & Err.Number & " Occurred"
    Resume BeforeUpdate_End
End Sub

0
Utf
3/18/2010 6:58:16 PM
access.forms 6864 articles. 2 followers. Follow

6 Replies
785 Views

Similar Articles

[PageSpeed] 36

You should be able to just copy the same code into the On Load event.

Private Sub Form_Load()

    Me.DateModified = Now()
    Me.ModifiedBy = fOSUserName()

End Sub

0
ghetto_banjo
3/18/2010 7:56:55 PM
What is your point in placing it in the Load event?  This will only cause the
fields in the first record that loads to be changed, and what if that record
isn't actually modified?  It will now have erroneous information.

-- 
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/Forums.aspx/access-forms/201003/1

0
Linq
3/18/2010 9:19:19 PM
The 'modifiedby' field is what I found on the forum, my field is actually 
called 'User' and I am using it to capture what user is entering data into 
the form. I want it to populate automatically when the user opens the form.

"Linq Adams via AccessMonster.com" wrote:

> What is your point in placing it in the Load event?  This will only cause the
> fields in the first record that loads to be changed, and what if that record
> isn't actually modified?  It will now have erroneous information.
> 
> -- 
> 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/Forums.aspx/access-forms/201003/1
> 
> .
> 
0
Utf
3/24/2010 3:19:03 PM
=?Utf-8?B?SWFnbw==?= <Iago@discussions.microsoft.com> wrote in
news:50FA36E3-2AA8-45ED-9B37-0E5068C56F8D@microsoft.com: 

> The 'modifiedby' field is what I found on the forum, my field is
> actually called 'User' and I am using it to capture what user is
> entering data into the form. I want it to populate automatically
> when the user opens the form. 
> 
I think you really would want it to save the user when the user 
actually updates the information in the form to the table. To do that 
use the Form's Before_Update Event. 

Using the Load event means that EVERY user will be shown as the USER 
in EVERY ROW that is looked at, as well as the ones that do get new 
data entered..

I'm sure that's not what you really want.

as to the different field name, just change me.ModifiedBy to me.User

Bob Q




> "Linq Adams via AccessMonster.com" wrote:
> 
>> What is your point in placing it in the Load event?  This will
>> only cause the fields in the first record that loads to be
>> changed, and what if that record isn't actually modified?  It
>> will now have erroneous information. 
>> 
>> -- 
>> 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/Forums.aspx/access-forms/201003/1
>> 
>> .
>> 
> 



-- 
Bob Quintal

PA is y I've altered my email address.
0
Bob
3/24/2010 9:51:20 PM
Bob Quintal wrote:
"Using the Load event means that EVERY user will be shown as the USER 
in EVERY ROW that is looked at, as well as the ones that do get new 
data entered."

Actually, placing this in the Form_Load event will only effect the first
record displayed, not every record!

-- 
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/Forums.aspx/access-forms/201003/1

0
Linq
3/25/2010 1:38:35 PM
"Linq Adams via AccessMonster.com" <u28780@uwe> wrote in
news:a589aae4ce2b7@uwe: 

> Bob Quintal wrote:
> "Using the Load event means that EVERY user will be shown as the
> USER in EVERY ROW that is looked at, as well as the ones that do
> get new data entered."
> 
> Actually, placing this in the Form_Load event will only effect the
> first record displayed, not every record!
> 
If the load event places the data into an unbound box, and code in 
another event writes it to the table, it will affect every row. 

-- 
Bob Quintal

PA is y I've altered my email address.
0
Bob
3/25/2010 9:02:53 PM
Reply:

Similar Artilces:

ntbackup of exchange- events 102 & 104?
exchange 5.5 on nt4 server- I have nt backup schedulde to run at night, in the event logs, it shows events 102 and 104, which is the store stopping and starting the backup. There are also ntbackup events showing the backup starting and completing in 2 hours, so it looks like everything is working, but what are those other events? Which events do you mean ? What are the description of the events ? What does the ntbackup log report ? Regards Paul Ford Edge IT Ltd "dlw" <dlw@discussions.microsoft.com> wrote in message news:E6AA3F41-DC5F-4E0A-89A9-A25DB9696B6D@microsoft...

loading network card information ...error provider load failure
This is a multi-part message in MIME format. ------=_NextPart_000_000F_01CA7D92.03F9F310 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi there, I get "loading network card information ...error provider load failure" = when I go and use systeminfo.exe . How can I fix this? Thanks, Gordon ------=_NextPart_000_000F_01CA7D92.03F9F310 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN&qu...

Coding in a subform in response to an event
I am a new comer...I am building a form with a subform. In the subform, when a conditional event occurs, like the number entered is more than 12, the number turns red and a msgBox pops up with a warning. Here is the code: Private Sub strHGB_BeforeUpdate(Cancel As Integer) With Me!strHGB If (.Value >= 12) Then Me!strHGB.ForeColor = 255 MsgBox "Review DOQI Guidelines for HGB >= 12." Else Me!strHGB.ForeColor = 0 End If End With End Sub-- My problem is that the forecolor change does not occur in the subform (datasheet view). It will turn ...

OWA (Not Loading)
Does anyone know of any issues with Satellite Service and the right side of OWA not loading. The left side loads but the user cannot see anything on the right. OWA works from any other connection. Thanks, KG ...

SOS,how to load a invalid or damaged .gif file to create Image Object.
hi everyone. my question is this:how to load a .gif image file that is invalid or damaged image format? Notice,I want to load the invalid damaged image file to operate it. my code is below,but all of they are not correct. -------- 1.Image.FromFile(fileName);load from a file directly,it throws a OutOfMemoryException.In msdn,it's mean the file is a invalid image format. 2.Image.FromStream(stream);load from stream,it throws a ArgumentException. -------- ps:IE and Google Picasa can load and display the damaged .gif file correct. Or there is any other methods to operate the i...

Error loading CRM 3.0 Client with Outlook
I receive error message "An error occurred loading Microsoft CRM Functionality" when starting Outlook with CRM 3.0 client installed. I have uninstalled CRM, Office, and cleaned the register using Register Mechanic. I am now getting the same error with an event error "A problem occurred initializing Microsoft CRM COM interopt". Anyone have any ideas? Thanks. I have the exact same issue has anyone found a solution to this? I am running all avialable updates on both Office 2003 and XP Pro, I DO NOT have the Business Contact Manager for Outlook installed. "rtop...

The connection was dropped due to an SMTP protocol event sink.
Hello, Today noticed large email queue on SBS2003, cannot send emails to any outside domain, and in addiditional queue information i see this message - The connection was dropped due to an SMTP protocol event sink. Our SBS2003 is used for email recieving and sending, no external smart hosts and server is behind firewall. Looks like our internal AD DNS is working fine, i can recieve recrusive answers from DNS(cheked with nslookup), also i can connect with telnet to port 25 to any mail server in queue, also i can connect to my server from interet with telnet on port 25. I ena...

Event ID:12014: unable to support the STARTTLS SMTP verb for the connector Does it matter?
In order to send mail to the rest of the world I have put a fqdn on the send connector which matches the PTR record for the IP address. I get a warning: Source: MSExchangeTransport Event ID: 12014 Microsoft Exchange couldn't find a certificate that contains the domain name foo.bar in the personal store on the local computer. Therefore, it is unable to support the STARTTLS SMTP verb for the connector RestOfWorld with a FQDN parameter of foo.bar Does it really matter if I am sending SMTP to the internet? Frank Dear Frank Yes en No Yes: If you wan...

GMT(UTC) date Storage Retrieval Questions
I'm planning on converting all my database times to UTC. I've have all the procedures set up for converting LocalUTC and UTCLocal. One potential issue that comes to mind is what I call "Date RollUp" That is the time period at UTC time for a date, which will break differently than at the users TimeZone (e.g. Central Standard Time) when rolling up "dependent" data because of the time (hh:mm:ss) the data was originally time stamped (e.g. Central Standard Time). This may have an effect on dependent field values. For example if you are taking sales a...

User control causes postback but events do not fire
Using 3.5, we have a user control (let’s call it Container.ascx) which has an asp:UpdatePanel with UpdateMode=”Conditional” and EnableViewState=”false”. It contains a table of asp:LinkButtons. In the markup, the Click event is declared for each LinkButton. This user control is loaded dynamically from its calling user control (Zone.ascx). After the LoadControl, it gets its ID set. The problem is that none of the LinkButton events for Container.ascx get fired although postback occurs and the EVENTTARGET property on the Request object shows the object which caused the postback co...

VS7 Error Runtime Checking Question
if I have something like while ( condition ) { =09Sometype=09Var; =09if ( firstTimeThruLoop ) =09=09var =3D something; =09OperationUsing ( var );=09// ****** } The SECOND time through the loop, VS7 gives an error in debug mode that var= is being used without being initialized, whereas VS6 doesn't. I can see where it's coming from, but it does make programs act differently= when built under different compilers. What is the C++ convention ? Is var supposed to be persistant thru each iteration of the loop or is it= initialized each time ? ie should var always be declared outside ...

Tickets or event manager
Does anyone know of a ticketing add on or an event manager for RMS. We have classes and tours we offer our clients and need a way to keep track of the participants and sales. We have a current pos at one site that does a great job of tracking sale for classes. I want to move all locations to RMS but this is in our way as we sell a lot of classes and trips. This is a multi-part message in MIME format. ------=_NextPart_000_0013_01CAD758.BE0CE350 Content-Type: text/plain; charset="Utf-8" Content-Transfer-Encoding: quoted-printable Try Retail Realm www.retailreal...

Hyperlink Question #5
We have an Excel workbook that contains hyperlinks to Excel and Word documents on other parts of our network. The problem occurs when we try to create a hyperlink to a particular document in a particular folder. When the document is seleected in the Insert Hyperlink window, the OK button is greyed-out. We can create hyperlinks to other Word documents in that folder, so permissions is not an issue. The document can be opened from Explorer and its permissions are set to “Unrestricted Access”. Its properties seem to be the same as the other documents in the folder, and Security is set to ...

loading web application project suddonly takes 5 mintues and says "Contacting server to open Web project.." wile it takes 5 minutes to load. how to fix? i tried reregistering asp.net and iisreset. no
loading web application project suddonly takes 5 mintues and says "Contacting server to open Web project.." wile it takes 5 minutes to load. how to fix? i tried reregistering asp.net and iisreset. no progres. ...

What do I load ?
Hello. I'm trying to develop a web comsuming client using VS.NET 2003(VB), .NET Framework 1.1.4322, ASP.NET 1.1.4322, WSE2.0 on a WinXP Pro Sp2 comuter. If i comsume this web service: https://xatanet.net/xatanetwebservice/tripexportservice.asmx and do this operation: RetrieveArchivedTrips using: Dim strDate As Date = "2006-04-01" Dim endDate As Date = "2006-04-28" proxy.RetrieveArchivedTrips(strDate, endDate) What do I load when i use the following statements in my program: Dim doc as XmlDocument = new XmlDocument() doc.Load() Any...

Debug image fails to load.
Hi, I created an OS design with KITL, Kernel debugger enabled in Debug mode. But when i try to load the image to the CEPC it fails to boot. I am attaching the log here. ------ SERIAL PORT LOG starts ----------- Microsoft Windows CE Ethernet Bootloader Common Library Version 1.0 Built Dec 9 2002 18:35:13 Copyright (c) 2000-2001 Microsoft Corporation Microsoft Windows CE Ethernet Bootloader 3.3 for CE/PC (Feb 6 2003) Boot Args @ 0x1F136 and ucLoaderFlags is 1 PCI Device Configurations (3 PCI bus(es) present)... ======================================================== Bus, Devi...

event logs -> syslog
With 2003 R2, is there a way to send the event logs to a syslog server out of the box, or do i need to invest in a 3rd party solution? Thanks. Doubtful out-of-box but you might ask around here and in the scripting groups/forums. http://kb.monitorware.com/viewforum.php?f=4 -- Regards, Dave Patrick ....Please no email replies - reply in newsgroup. Microsoft Certified Professional Microsoft MVP [Windows] http://www.microsoft.com/protect "Kevin Hartman" wrote: > With 2003 R2, is there a way to send the event logs to a syslog server out > of th...

Click on a link and a picture loads in cell depending on which link you have clicked
Hello If I have five links in cells A1:A5 with peoples names. How can get... e.g. If I click on Bill in A2 then a picture of Bill loads in cell D1 an then click Mark and a picture of Mark loads in D1. Thanks in advanc -- Message posted from http://www.ExcelForum.com I'm not sure what you mean by link in A1 through A5, but I'd try it this way: Put all 5 pictures on the worksheet and position them where you want them. Name them to match the values in A1:A5. Select the picture for Bill and then type Bill in the name box (to the left of the formulabar) and hit enter. After all 5...

Migrating Exchange 5.5 multi-sites question
Hi We have a Windows 2000 AD Domain with an Exchange 5.5 organisation with 4 remotes sites located in remote locations. I installed Exchange 2003 on a Windows 2003 member server in SiteA. This server has the ADC installed with 4 CAs. I have moved the users from SiteA into Exchange 2003 with no problems. I plan to install Exchange 2003 on new Windows 2000 servers in the remote sites and move users using the wizard. The question is do I need ADC installed on these remote sites servers with CAs so that I can move users. Will these CAs be two-way.?? Is there anything else I would need to do.?? ...

Office for Mac licensing question
I have an older Power Mac that runs Office 2001 for Mac on OS 9.1. I want to keep the older Mac and still use Office 2001 on it. I also want to get a new Mac (G4 probably) and run Office V. X on OS 10.3. Do I need to purchase a full-up version of Office V. X to install on the new Mac or can I purchase the Office V. X upgrade version instead? If I can get by with an upgrade, do I need to install Office 2001 on the new Mac and then uninstall Office 2001 after the upgrade is completed (since Office 2001 is running another Mac)? I basically want to run both Macs at the same time (an olde...

Loading Error
Hi I am logged on as Domain administrator and have installed Office 2000 twice over.. I am getting the following error, and I have put it into Microsoft Support but it comes up with nothing. The error is "Unknown Error 0xAF54011D You Do not have permission to log on" any Ideas thanks It helps telling where you get this error and where you are trying to connect to. -- Roady [MVP] www.howto-outlook.com Tips of the month: -Setting Permissions on a Mailbox -Create an Office XP CD slipstreamed with Service Pack 3 ----- "News" <sasa@sdfad.com> wrote in message ...

Ev�nements Load et Unload
Quelqu'un peut-il me dire pourquoi je n'arrive pas � s�lectionner les �v�nements Load et Unload dans la partie droite de mon UserForm (et ce qu'il faut faire). (Je n'ai pas d'�v�nements Load et Unload dans la partie droite de ma liste, la partie gauche ayant le nom UserForm). D'avance merci, Jean-michel ...

way of thinking question.
Ok; each of our school have a computer lab with a lab manager. The lab manager serves as the first point of contact for teachers with tech problems. In one of the schools, there are two people job sharing the lab manager role. Since the days are not set, lab manger A may work M/W/F one week, and M/T/W another week. I realized that a teacher may not know who was on duty on a particular day. The fix I came up with is to create a two person distro group, and then have every message send to the lab managers distro group would go to both, and then the person on duty can respond accordingly....

CSplitterWnd questions,
When my program starts, only one view of the four splitter window shows. I have to manually drag the bars to induce the other 3. My question is: how do I readjust the size of each splitter window in code? Also, what method do I use to get a HWND (or CWnd) to each subdivided window? vsgdp wrote: > When my program starts, only one view of the four splitter window shows. I > have to manually drag the bars to induce the other 3. My question is: how > do I readjust the size of each splitter window in code? Also, what method > do I use to get a HWND (or CWnd) to each subdi...

Formula question #2
how do i make a formula so that a specific cells continuosly accumulates every time another amount on a different cell is entered. eg: on a payroll sheet, the year to date field What do you want to accumulate the number of entries [use the =Count(range) or =counta(range)function], or the value of the entries [use the =sum(range( function)] ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ Hi zerep, Check here for info: http://www.mcgimpsey.com/excel/accumulator B...