473,490 Members | 2,635 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Combo Box Control

25 New Member
I'm sorry if this question sounds stupid to you.

I'm trying to create a combo box which can allow the user to choose the desired table to insert some records into. This is wat i have.. it doesn't work as it's something i just made up and tot i give it a try.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Combo0_AfterUpdate(Cancel As Integer)
  2. Dim Seltable As String
  3.  
  4.     Seltable = Me.Combo0.Column(1)
  5.  
  6. If Seltable = "CustData" Then
  7.     DoCmd.RunSQL "INSERT INTO [CustData] SELECT * FROM Template"
  8. End If
  9. End Sub
Please and Thank you!!
Sep 13 '07 #1
3 1256
JConsulting
603 Recognized Expert Contributor
I'm sorry if this question sounds stupid to you.

I'm trying to create a combo box which can allow the user to choose the desired table to insert some records into. This is wat i have.. it doesn't work as it's something i just made up and tot i give it a try.

Private Sub Combo0_AfterUpdate(Cancel As Integer)
Dim Seltable As String

Seltable = Me.Combo0.Column(1)

If Seltable = "CustData" Then
DoCmd.RunSQL "INSERT INTO [CustData] SELECT * FROM Template"
End If
End Sub


Please and Thank you!!
Try
Expand|Select|Wrap|Line Numbers
  1. CurrentDB.Execute "SELECT * INTO [CustData] FROM Template"
  2.  
J
Sep 13 '07 #2
hr833
25 New Member
Try
Expand|Select|Wrap|Line Numbers
  1. CurrentDB.Execute "SELECT * INTO [CustData] FROM Template"
  2.  
J

This will only work for one table right? how can u make [CustData] a varable so if the user were to choose a different table it will still work.
Sep 13 '07 #3
JConsulting
603 Recognized Expert Contributor
This will only work for one table right? how can u make [CustData] a varable so if the user were to choose a different table it will still work.
Expand|Select|Wrap|Line Numbers
  1. CurrentDB.Execute "SELECT * INTO " & me.combo0.column(1) & " FROM Template"
  2.  
  3.  and you might need ticks around the variable because it's a string
  4.  
  5. CurrentDB.Execute "SELECT * INTO '" & me.combo0.column(1) & "' FROM Template"
  6.  
Sep 13 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
3551
by: Kent Eilers | last post by:
I want to follow naming conventions for my controls - i usually prefix combo boxes with "cbo". When a form is in datasheet view however i do not want the user to see the 'cbo' prefix in front of...
1
1412
by: Edward | last post by:
I have encountered a combo box acting with a mind of its own in a VB.NET Windows app. I have a wizard consisting of a tab control; depending on which page is being displayed the tabs are added...
7
1564
by: Hans Merkl | last post by:
Hi, Can anybody recommend a combo box control (textfield + dropdown list) for ASP.NET? I have looked at some products and it seems they all have some problems. I haven't yet found a combo box...
0
2913
by: Jeremy Wallace | last post by:
Folks, Here's a write-up I did for our developer wiki. I don't know if the whole rest of the world has already figured out how to do this, but I hadn't ever seen it implemented, and had spent a...
0
1577
by: Tom | last post by:
I have some very strange issues with combo boxes on a tab control. Here's the scenario: I have a Windows Forms form that has a tab control on it, with two (2) tabs. Tab 2 happens to have a number...
8
2178
by: AA Arens | last post by:
Hi I do have a products table and products-parts table in my Access 2003 database and log all services into a form. I do have at least the following two combo boxes on my form: - Choose...
4
64522
Rabbit
by: Rabbit | last post by:
Cascading Combo/List Boxes This tutorial is to guide you in the creation of Cascading combo/list boxes. That is when you have multiple combo/list boxes where the selection of an option in one...
6
3666
by: Dave | last post by:
I want to put the information that the user selects in my combo boxes into a subform that lies on the same form as the combo boxes. Thanks for your help already, Dave
13
8596
by: mirandacascade | last post by:
I want to set things up such that a section of code will have been executed by the time one clicks on the drop down arrow on a combo box control. Currently, that section of code resides in the...
0
7112
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6974
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7183
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6852
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5448
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3084
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3074
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1389
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
628
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.