At wits end...

  • Thread starter Thread starter bill
  • Start date Start date
B

bill

I'm a complete novice/newbe at wits end and in desperate
need of elementary assistance...

In an unbound form (FORM-A), I have a list box (with 2
columns):
X Description of X
Y Description of Y
I want to store selected item ("X" only) in TABLE-Z.

1.Can this be done?
2.How do I (specifically) code the listbox to do this?

Any elementary help is gratefully appreciated! Thank you
in advance for help given!!
 
Bill,

In the listbox's AfterUpdate event, add the following code:
Dim sSQL As String

sSQL = "INSERT INTO TABLE-Z (X) VALUES (""" & Me.lstMyListBox & """)"
CurrentDb.Execute sSQL, dbFailOnError

Of course, change the name of the listbox in the above code to reflect the
actual name of the listbox on the form.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
Back
Top