Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default Value on a form not working...?

Status
Not open for further replies.

Kumba1

Technical User
Aug 29, 2002
94
I have a data entry form... in it I have a hidden field called "Computer" that is supposed to be the computer the data was entered from... I have a function called "MachineName" that returns the name of the computer... how do I get it, so that when someone enters new information, the field "Computer" automatically has the computer name entered into it... is there any way?
 
It could be this simple:

From the BeforeUpdate event for the data entry form build code similar to this:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.Computer = MachineName
End Sub

"Me" references the open form
"Computer" references your field, which I assume is the field name of the table bound to the form
"MachineName" is the variable containing the name of the computer (returned from your function)

Hope this helps.
 
That definately works... I tried setting an unbound box on the main form, and on formload, the box is set to the results of the function machinename via VB Code, but that doesn't work reliably... so I guess i'll use this till I run into a problem... you know what they say, if it works, and it aint broke, dont fix it :) Many thanks to you sir...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top