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!

Blank form fields 1

Status
Not open for further replies.

tebathe3

Programmer
Jan 17, 2004
89
US
My users are requesting that I create a feature for a form at our work that allows them to click a button and import the information they entered for the previous form they did. I'm saving the small amt of data out to the registry and that's no problem. The problem arises when one of the fields is left blank. They do need to be able to leave a field blank if they choose, but if I try to select the text from a bookmarked field, a blank field will insert 5 "boxes" into the registry. Any ideas on how to determine if a field in particular is blank?
 
Any chance you could post the relevant pert of your code ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Sure, here it is. I've tried all kinds of variations in getting the text out of the bookmarked field, but it always comes back with the "boxes" when there is no text in it.

Code:
  If ActiveDocument.Bookmarks.Exists("bmkTitle") Then
        Dim strTitle As String
        strTitle = ActiveDocument.Bookmarks("bmkTitle").Range.Text
        
        
        SaveSetting APPNAME, "Foreign", "Inventors", strTitle
    End If
[/code
 
You may try this:
SaveSetting APPNAME, "Foreign", "Inventors", IIf(strTitle > " ", strTitle, " ")

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Are you using FormFields? If so, try:
Code:
strTitle = ActiveDocument.FormFields("bmkTitle").Result
When the field is empty, strTitle will be assigned an empty string.


Regards,
Mike
 
rmikesmith, that one finally worked, thank you!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top