フォーム上のコントロールを取得する時に、
「テキストボックスかコンボボックスなら」としたいのですが、VBAコードがわかりません。
************************************************************
Sub Sample()
Dim myCtrl As Control
Dim myForm As String
myForm = "フォーム1"
For Each myCtrl In Forms(myForm).Controls
If myCtrlのタイプがテキストボックス Or コンボボックス Then
Debug.Print myCtrl.Name
End If
Next
End Sub
************************************************************
に修正していただけますか?
ControlType プロパティを使うと思うのですが、使い方がわかりません。
ご回答よろしくお願いします。
No.1ベストアンサー
- 回答日時:
For Each ctl In Form_F上.Controls
If (ctl.ControlType = acTextBox) Or (ctl.ControlType = acComboBox) Then
Debug.Print ctl.Name
End If
Next ctl
で、うまくいきました。ありがとうございました。
お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!
関連するカテゴリからQ&Aを探す
おすすめ情報
- ・漫画をレンタルでお得に読める!
- ・人生のプチ美学を教えてください!!
- ・10秒目をつむったら…
- ・あなたの習慣について教えてください!!
- ・牛、豚、鶏、どれか一つ食べられなくなるとしたら?
- ・【大喜利】【投稿~9/18】 おとぎ話『桃太郎』の知られざるエピソード
- ・街中で見かけて「グッときた人」の思い出
- ・「一気に最後まで読んだ」本、教えて下さい!
- ・幼稚園時代「何組」でしたか?
- ・激凹みから立ち直る方法
- ・1つだけ過去を変えられるとしたら?
- ・【あるあるbot連動企画】あるあるbotに投稿したけど採用されなかったあるある募集
- ・【あるあるbot連動企画】フォロワー20万人のアカウントであなたのあるあるを披露してみませんか?
- ・映画のエンドロール観る派?観ない派?
- ・海外旅行から帰ってきたら、まず何を食べる?
- ・誕生日にもらった意外なもの
- ・天使と悪魔選手権
- ・ちょっと先の未来クイズ第2問
- ・【大喜利】【投稿~9/7】 ロボットの住む世界で流行ってる罰ゲームとは?
- ・推しミネラルウォーターはありますか?
- ・都道府県穴埋めゲーム
- ・この人頭いいなと思ったエピソード
- ・準・究極の選択
デイリーランキングこのカテゴリの人気デイリーQ&Aランキング
-
iphoneのフルスクリーンの解除方法
-
【ACCESS】フォーム名/コントロ...
-
ACCESS2000で カレンダコントロ...
-
Excel 入力規則 リスト 複数...
-
Accessのカレンダーコントロー...
-
EXCELLチェックボックス...
-
Accessでフィールド名を変数(...
-
午後のこ~だのライン入力MP3録...
-
Pict Bear SE 右側の部分が出...
-
YahooのIDがロックされてしまい...
-
Access レポート印刷するときに...
-
passwordが入れられません・・・・
-
データベースのINT型項目にNULL...
-
Access(office)のマクロの「値...
-
サブフォームに対してGoToRecor...
-
アクセスのレポート合成(複数...
-
エクセルのソルバーについての...
-
ExcelVBAでセルをクリックして...
-
ActiveXコントロールのコンボボ...
-
フィルタ後のフォームの件数の...
マンスリーランキングこのカテゴリの人気マンスリーQ&Aランキング
-
iphoneのフルスクリーンの解除方法
-
ACCESSでコントロールソースの変更
-
Accessのフォームにて、詳細行...
-
【ACCESS】フォーム名/コントロ...
-
Accessでフィールド名を変数(...
-
ACCESSのフォームからハイパー...
-
アクセスで、チェックボックス...
-
Excel ユーザーフォーム呼び出...
-
Excel 入力規則 リスト 複数...
-
アクセスフォームで2つを結合テ...
-
Accessの連結、非連結とは何?
-
access 改ページコントロール
-
アクセスのフォームの区切り線...
-
access setfocusについて
-
After Effectsでレイヤーの表示...
-
Access・VBAで、Controlsを使用...
-
コントロールソースって
-
ACCESS テキストボック...
-
Winampのボリューム
-
アクセスのフォームでテキスト...
おすすめ情報