Results 1 to 2 of 2

Thread: [RESOLVED] Can I use a pop-up window to add info to a db table?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2006
    Posts
    475

    Resolved [RESOLVED] Can I use a pop-up window to add info to a db table?

    I have a combobox that displays names of movie actors from the actor table in a DB. I have the following code:-
    VB Code:
    1. Private Sub cmdAdd_Click()
    2.  
    3.     Dim strNewItem As String
    4.     strNewItem = InputBox(prompt:="Enter Actor's name")
    5.     cboAddActor.AddItem strNewItem
    6.    
    7. End Sub
    Which adds an actor's name into a combobox. But I wish to know whether as the name is added into the combobox, I can get it added into the the database too, using INSERT code.

    Thanks

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: [RESOLVED] Can I use a pop-up window to add info to a db table?

    VB Code:
    1. Private Sub cmdAdd_Click()
    2.  
    3.     Dim strNewItem As String, strSQL As String
    4.     strNewItem = InputBox(prompt:="Enter Actor's name")
    5.     cboAddActor.AddItem strNewItem
    6.     strSQL = "Insert into actortable ([Name])  Values('" & strNewItem & "')"
    7.     YourConnection.Execute strSQL
    8.    
    9. End Sub
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width