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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding an entry to a drop down menu

Status
Not open for further replies.

jep

Technical User
Sep 6, 2001
1
US
I have created a drop down menu (keywords) that list all my entries from my database. I also have a text field (newkeyword) and a Add keyword button (addkeyword). All I am trying to do is add the new keyword to the database and update the drop down menu. My code is as follows.

<SCRIPT LANGUAGE = &quot;VBScript&quot;>
<!--
Option Explicit

Private Sub addkeyword_Click()
On Error GoTo Err_addkeyword_Click

newkeyword.SetFocus
DoCmd.RunSQL &quot;INSERT INTO Keywords (KeywordText) VALUES ('&quot; + newkeyword.Text + &quot;')&quot;

keywords.Requery

Exit_addkeyword_Click:
Exit Sub

Err_addkeyword_Click:
MsgBox Err.Description
Resume Exit_newkeyword_Click

-->
</SCRIPT>

This is the first time I have attempted such a thing and I have simply ported code from Access. This code doesn't work, please help.

Thankyou in advance :)
 
This is an ASP or HTML?

ASP
If u are using an acess database u have to be careful to '(this is for SQL), in acess is &quot; and in vb if u want to insert &quot; in database u have to put &quot;&quot; in place of &quot;
The line
DoCmd.RunSQL &quot;INSERT INTO Keywords (KeywordText) VALUES ('&quot; + newkeyword.Text + &quot;')&quot;
looks like
DoCmd.RunSQL &quot;INSERT INTO Keywords (KeywordText) VALUES (&quot;&quot;&quot; + newkeyword.Text + &quot;&quot;&quot;)&quot;
________

George
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top