That's how to modify the RowSource. RowSource can be modified that way.
Jay's wanting to modify the ControlType of a control. That can't be done
unless the form is open in design mode. Of course, I can't see any reason
why you'd want to change it programmatically. If sometimes you need a text
box and sometimes a combo box, put both on the form, and only make one
visible at a time.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"UpRider" <(E-Mail Removed)> wrote in message
news:OMB$(E-Mail Removed)...
> Jay, Here's an actual example of modifying a form via VBA in design mode:
> DoCmd.OpenForm "frmInputBox", acDesign
> Forms!frmInputbox!lstZip.RowSource = "SELECT Zip, City, St, ZipID FROM
> tblZipcode " _
> & "WHERE tblZipcode.Zip=fcnZipArg(2);"
> DoCmd.Close acForm, "frmInputBox", acSaveYes
> DoCmd.OpenForm "frmInputBox"
>
> HTH, UpRider
>
> "jay" <(E-Mail Removed)> wrote in message
> news:CB0C6C0B-5E6E-41FC-BA86-(E-Mail Removed)...
>> --------------------------------------------------------------------------------
>>
>> I am using this code to change a text box into a combo box with VBA Code.
>>
>> txtBox.ControlType = acComboBox
>>
>> when I run it it says "to set this property, open the form in design
>> view"
>> ...which defeats the purpose of doing it in VBA.
>>
>> any thoughts???
>
>