Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-12-2012, 08:19 AM
skusekd skusekd is offline Word 2007 - Drop Box Issue Windows 7 32bit Word 2007 - Drop Box Issue Office 2007
Novice
Word 2007 - Drop Box Issue
 
Join Date: Sep 2012
Posts: 5
skusekd is on a distinguished road
Default Word 2007 - Drop Box Issue

Hi!



I'm trying to create a fillable form for my co-workers and I to ensure accuracy while maintaining speed. We fill out and send multiple forms simultaneously.

Therefore, I'm attempting to create a drop down list, but as options change regularly, I'd like users to be able to type into the drop box without having to explain how to use Word's options. It needs to be user friendly, as not everyone is computer savvy.

Any assistance would be greatly appreciated!

Thank You.
Kait
Attached Files
File Type: docx Deduction Form (posting).docx (15.1 KB, 10 views)
Reply With Quote
  #2  
Old 09-12-2012, 09:22 AM
macropod's Avatar
macropod macropod is offline Word 2007 - Drop Box Issue Windows 7 64bit Word 2007 - Drop Box Issue Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Kait,

Dropdown formfields don't permit typed input. If you're wanting people to be able to substitute something for 'other', see: https://www.msofficeforums.com/17071-post2.html
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 09-13-2012, 10:33 AM
skusekd skusekd is offline Word 2007 - Drop Box Issue Windows 7 32bit Word 2007 - Drop Box Issue Office 2007
Novice
Word 2007 - Drop Box Issue
 
Join Date: Sep 2012
Posts: 5
skusekd is on a distinguished road
Default Macro

Thank you for the help!

Now I'm having a new issue, probably b/c I've never used macros, and may be getting in a little over my head.

My code seems to be faulty, can you find the error, please? :S

-----------------------------------------------------------------------
Code:
Sub OnExitDDListA()
Dim oDD As DropDown
Dim oFFs As FormFields
Dim StrNew As String
Set oDD = ActiveDocument.FormFields("NAME").DropDown
'Clear previous list
oDD.ListEntries.Clear
'Repopulate list based on user selection
Select Case ActiveDocument.FormFields("TYPE").Result
  Case "Hotels"
    With oDD.ListEntries
      .Add "Best Western Hotel"
      .Add "BonAir Hotel"
      .Add "Econo Lodge"
      .Add "Elect Inn"
      .Add "Glenmore Inn"
      .Add "HoBo Lodge"
      .Add "Holiday Inn"
      .Add "Howard Johnson Inn"
      .Add "Travellers Inn"
      .Add "Other"
    End With
    With ActiveDocument.FormFields("TYPE").DropDown
      If .Value = 10 Then
        StrNew = Trim(InputBox("Input your text", "Free text input"))
        If StrNew = vbNullString Then
          .ListEntries(10).Delete
          .ListEntries.Add StrNew
          .Value = 10
        End If
    End With
  Case "Air Fare"
  Case "Certificates"
    With oDD.ListEntries
      .Add "Aerial Platform"
      .Add "Fall Protection"
      .Add "WHMIS"
      .Add "Other"
    End With
  End Select
lbl_Exit:
Exit Sub
End Sub

Last edited by macropod; 09-13-2012 at 03:29 PM. Reason: Added code tags & formatting
Reply With Quote
  #4  
Old 09-13-2012, 04:03 PM
macropod's Avatar
macropod macropod is offline Word 2007 - Drop Box Issue Windows 7 64bit Word 2007 - Drop Box Issue Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Kait,

Your code fails because there's and 'End If' missing between 'End If' and 'End With'.

Having said that, I can't see why you've made it so complicated. The much simpler code I pasted was all you needed. Indeed, your code is going to create problems by adding new (duplicate) entries to each dropdown formfield and, when you exceed 25, the code will fail.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 09-14-2012, 06:36 AM
skusekd skusekd is offline Word 2007 - Drop Box Issue Windows 7 32bit Word 2007 - Drop Box Issue Office 2007
Novice
Word 2007 - Drop Box Issue
 
Join Date: Sep 2012
Posts: 5
skusekd is on a distinguished road
Default Macro

Well, I decided I wanted to do more with the form. I'm attempting to link the two drop-down menus.

I'd like to have the second drop-down menu dependant on the choice of the first drop-down menu.

ie. if you select hotels, only the list of hotels show, and if you select certificates only the list of certificates show.

As opposed to breaking the form into different sections.

However, thus far I've got squat
Reply With Quote
  #6  
Old 09-14-2012, 04:54 PM
macropod's Avatar
macropod macropod is offline Word 2007 - Drop Box Issue Windows 7 64bit Word 2007 - Drop Box Issue Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Well, that is rather different to what we set out with. While it is do-able, I think it both complicates input (the user will have to choose a 'type' before being able to select one of the options for that 'type') and is also liable to create difficulties for those who have to process the data later on as there is no necessary consistency in the order or location in which items might be recorded. Furthermore, if the user selects the wrong type, then goes back and changes it, the dropdown will then have entries available for both types. Obviously, additional code will be required to clear the dropdown every time a 'type' is selected, before any new items are added.

Before proceeding, I'd suggest a re-think. If you do decide to go ahead, you'll need to post a copy of the revised document that the code is meant to work with.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 09-17-2012, 08:36 AM
skusekd skusekd is offline Word 2007 - Drop Box Issue Windows 7 32bit Word 2007 - Drop Box Issue Office 2007
Novice
Word 2007 - Drop Box Issue
 
Join Date: Sep 2012
Posts: 5
skusekd is on a distinguished road
Default Macro

Thank you again!

I see what you're saying about the organization of the form, without separate headings it would be a little chaotic. So, back to the simple more organized idea

Problem though, I'm getting this error:

"Complie error: Invalid or unqualified reference" referring to the .Value in the "if .value = 11 Then"

Here's the macro I pasted along with my (minor) changes:

Code:
Sub FreeText()
Dim StrNew As String
With ActiveDocument.FormFields("NAME").DropDown
  If .Value = 11 Then
  StrNew = Trim(InputBox("Input your text", "Free text input"))
  If StrNew = vbNullString Then Exit Sub
    .ListEntries(11).Delete
    .ListEntries.Add StrNew
    .Value = 11
  End If
End With
End Sub

Last edited by macropod; 09-17-2012 at 08:10 PM. Reason: Added code tags & formatting
Reply With Quote
  #8  
Old 09-17-2012, 08:14 PM
macropod's Avatar
macropod macropod is offline Word 2007 - Drop Box Issue Windows 7 64bit Word 2007 - Drop Box Issue Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

That may be because you don't have 11 entries - your previous examples only had 10.

FWIW, you can get around the need to keep count of how many entries there are by using:
Code:
Sub FreeText()
Dim StrNew As String, i As Long
With Selection.FormFields(1).DropDown
  i = .ListEntries.Count
  If .Value = i Then
    StrNew = Trim(InputBox("Input your text", "Data Entry", .ListEntries(i).Name))
    If StrNew = vbNullString Then Exit Sub
      .ListEntries(i).Delete
      .ListEntries.Add StrNew
      .Value = i
  End If
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #9  
Old 09-19-2012, 07:54 AM
skusekd skusekd is offline Word 2007 - Drop Box Issue Windows 7 32bit Word 2007 - Drop Box Issue Office 2007
Novice
Word 2007 - Drop Box Issue
 
Join Date: Sep 2012
Posts: 5
skusekd is on a distinguished road
Default Macro

Thank you SO much!

It works perfectly!
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Word 2007 Cannot Drag and Drop Rbooks Word 7 02-05-2015 11:27 AM
Word 2007 - Drop Box Issue word 2007 - space issue dupefree Word 1 06-27-2012 06:05 AM
Dependent drop down lists in Word 2007 benbenasc Word VBA 0 08-24-2011 06:34 AM
Word 2007 Issue dollsgen Word 1 08-21-2010 09:48 PM
Converting issue 2003 word to 2007(new to 2007 office) lbrown3 Word 0 01-30-2010 07:25 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:33 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft