Previous Entered Data in the from

G

Greg

I have created a database where a person will enter
sponsors of a team. I dont want to have to enter the team
name for each sponsor of that person. I want to enter it
the first time and have it hold that until I get to a new
team and enter the new team, kinda like a temporary
default value...Any ideas?? Thanks in advance.
 
K

Kevin Sprinkel

Kinda like a temporary
default value...Any ideas?? Thanks in advance.

I'm sure there are other ways to do this, but I do it by
calling a function in a Module that sets a public variable
(mstrTempDefault), then I set the field to the public
variable in the AfterUpdate procedure for the first field
in the form. You could put it other places as well, such
as the form AfterUpdate event.

I placed a command button on the form to call the public
function.

Public Sub SetTempDefault(strCurrent As String)
Dim strTemp As String
Dim strTitle As String
Dim x As Integer

On Error GoTo ErrHandler

strTitle = "Set Temporary Default Value"
strTemp = InputBox(Prompt:="Enter Temporary Default
Value: ", Title:=strTitle, Default:=strCurrent)

Select Case strTemp
Case strTemp = "" ' Do nothing, user cancelled
operation

x = MsgBox(Prompt:="User cancelled update. Default
will remain " & strCurrent, Buttons:=vbOKOnly,
Title:=strTitle)
Case Else
mstrTempDefault = strTemp
End Select


ErrExit:
Exit Sub

ErrHandler:
MsgBox (Err.Description)
Resume ErrExit

End Sub

HTH
Kevin Sprinkel
 
G

Guest

I used a tag to get the came result.

For Each ctl In Me.Controls
If ctl.Tag = "nonull" Then
Else
ctl.Value = Null
End If
Next ctl

So in the team name box, click on Properties and search for Tag, it's the last property under Other. Type in, nonull, and they should stay.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top