Hi Bob,
Strange request, but this should get you going...
Create two textboxes that are identical in size and shape. For the purposes
of this example, I named one of them txtBookTitle and the other one
txtHiddenTitle. I'm also using a field that is named BookTitle. Make the
appropriate substitutions in your case. Set the following attributes:
txtBookTitle
Visible: Yes
Control Source: leave blank (ie unbound)
txtHiddenTitle
Visible: No
Control Source: BookTitle
txtHidden
Visible: Yes
Width: 0
Height: 0
Back Color: Use the same value as the detail section
Special Effect: Flat
Border Color: Same as detail section
Fore Color: Same as detail section
Add the following procedures to the code module for this form:
Option Compare Database
Option Explicit
Private Sub Form_Current()
On Error GoTo ProcError
Me.txtHiddenTitle.Visible = Me.NewRecord
Me.txtBookTitle.Visible = Not (Me.txtHiddenTitle.Visible)
Me.txtHidden.SetFocus
ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in procedure Form_Current..."
Resume ExitProc
End Sub
Private Sub txtBookTitle_GotFocus()
On Error GoTo ProcError
Me.txtBookTitle = Me.txtHiddenTitle
ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in procedure txtBookTitle_GotFocus..."
Resume ExitProc
End Sub
Private Sub txtBookTitle_Exit(Cancel As Integer)
On Error GoTo ProcError
Me.txtBookTitle = ""
ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in procedure txtBookTitle_Exit..."
Resume ExitProc
End Sub
If you want to allow the user to edit an existing record, then add the
following procedure:
Private Sub txtBookTitle_BeforeUpdate(Cancel As Integer)
On Error GoTo ProcError
Me.txtHiddenTitle = Me.txtBookTitle
ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in procedure txtBookTitle_BeforeUpdate..."
Resume ExitProc
End Sub
Finally, position the two textboxes with exactly the same Left and Top
values, so that they are perfectly overlaying each other. The very small
txtHidden textbox receives focus (it's visible property must by Yes) when you
navigate between records. This way, the user is forced to click into the
txtBookTitle field in order to display the value.
Tom Wickerath
Microsoft Access MVP
http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________