| Chat with a LIVE Microsoft
Access Expert! |
||||
|
||||
|
#1
|
|||
|
|||
|
Selecting records
Hello everyone,
I am new one in Access programing so I will be grateful if someone can help me.The situation is this:I have main form frmOdabirOpreme.With button cmdNapajanje I open a new form frmNapajanje.On this form I have listBox lstNapajanje in which RowSource I have put - SELECT Napajanje.Referenca, Napajanje.Opis FROM Napajanje;(it is from Table Napajanje and it has two fields -Referenca and Opis). On this lstNapajanje I can see few records from Table Napajanje which I do not change.Now I want to select one of these records (by DoubleClick event on lstNpajanje) and copy it to another Table OdabranaOprema (which is connected to Excel file as invoice). What is the best way to do this? thanks, I have tried something like this! Private Sub lstNapajanje_DblClick(Cancel As Integer) Dim db As Database Dim strSQL As String 'create SQL to append records strSQL = "INSERT INTO OdabranaOprema (Referenca, Opis ) " _ & " SELECT " & Referenca & ", Opis " _ & " FROM Napajanje " _ & " ORDER BY Referenca;" 'run the SQL statement CurrentDb.Execute strSQL 'refresh the table definitions with records added by other persons/processes CurrentDb.TableDefs.Refresh 'wake-up call for Access DoEvents 'requery the subform Set rsOdabranaOprema = Nothing End Sub |
| Sponsored Links |
| Sponsored Links |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Selecting records and updating those selectedrecords | RHouse | General | 0 | 10-13-2005 03:09 AM |
| Selecting record's column in subform | kappa | Forms | 4 | 05-29-2005 06:15 AM |
| excluding records | Tim L | Queries | 3 | 10-22-2003 11:44 AM |
| Selecting the last 5 records | whitespaces | Queries | 2 | 07-30-2002 09:18 PM |
| Selecting all records in select Query on a subform | sush | Forms | 0 | 09-26-2001 10:49 AM |