Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unbound Combo Box

Status
Not open for further replies.

zgtrman

Programmer
Dec 4, 2002
62
US
The answer to this is probably simple but I have been out of the loop for over two years and I forgot how to do this.

Unbound Combo Box with Values that I typed in that are the names of the tables I have created..all the table have only two fields
1. key Primary Key Autonumber
2. Description Memo

I need to code a command button click event that will look at the value of the combo box and save the contents of the text box in the correct table Description Field.

I am doing this to save from typing the same text over and over again..I work in tech support inbound and outbound calls and I have to document my calls.


Thanks in advance for any help with this.

To effectively improve in the efficiency of your performance, one must be proficient in the implementation of a positive mental attitude.
 
How are ya zgtrman . . .

Perhaps the following in the [blue]Click[/blue] event of your button will do (Note: [blue]you![/blue] substitute proper names in [purple]purple[/purple]):
Code:
[blue]   Dim Msg As String, Style As Integer, Title As String, SQL As String
   Dim CBx As ComboBox, TBx As TextBox, DQ As String, DL As String
   
   Set CBx = Me.[purple][b][i]ComboboxName[/i][/b][/purple]
   Set TBx = Me![[purple][b][i]Description Memo[/i][/b][/purple]]
   DL = vbNewLine & vbNewLine
   Style = vbInformation + vbOKOnly
   
   If Me!CBx.ListIndex = -1 Then
      Msg = "No Data Selected in Combobox!" & DL & _
            "Make a selection and try again! . . ."
      Title = "No Combobox Selection Notice! . . ."
      MsgBox Msg, Style, Title
      Me!CBx.SetFocus
      Me!CBx.Dropdown
   ElseIf Trim(TBx & " ") = "" Then
      Msg = "No Description Supplied!" & DL & _
            "Enter a description an try again! . . ."
      Title = "No Description Notice! . . ."
      MsgBox Msg, Style, Title
      TBx.SetFocus
   Else
      SQL = "INSERT INTO '" & Me!CBx.Column([b]0[/b]) & "' ([Description Memo]) " & _
            "VALUES (" & DQ & TBx & DQ & ");"
      DoCmd.RunSQL SQL
   End If

   Set TBx = Nothing
   Set CBx = Nothing[/blue]
[blue]Your Thoughts? . . .[/blue]

BTW: To get great answers and know whats expected of you in the forums be sure to have a look at FAQ219-2884 [thumbsup2]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top