0

I am trying to allow users to double click on an item in a List box and then have the selected value (and some related values using SQL) input into a table that I have ready.

I would post the code that I have but the truth is I don't even know where to start so ANY help would be massively appreciated.

My List box (listResult) has 3 columns that I would like to be input into my table (Stock Conversion).

Thanks in advance,

Bob P

3
  • 1
    A good place to start is with a query built in the query design window that refers to the form you have created for data for an append query. You will then have some sql to play with. Commented Sep 28, 2012 at 14:49
  • Is there not some way of doing this with a line of code such as, but obviously not because it doesn't work, -- Stock Conversion.Update(listResult(0), listResult(1), listResult(2)) -- Commented Sep 28, 2012 at 14:54
  • Certainly, and when you post your sql, it will be a lot easier to say what to do. There are a dozen ways to skin this particular cat. Commented Sep 28, 2012 at 14:55

1 Answer 1

1

One possibility:

Dim qdf As QueryDef

'Temporary query
Set qdf = CurrentDb.CreateQueryDef( _
       "", "Insert Into Table1 (atext,anumber) values ([p1],[p2])")

qdf.Parameters("[p1]") = "abc"
qdf.Parameters("[p2]") = 20
qdf.Execute dbFailOnError
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.