My setup is VB6/Access2K. I need a click event on my VB Form that will append all of the Records from one Access Table (tblTEMP) to another Access Table (tblPERM)in the same Access mdb.
Insert into tblPERM ( field1, field2, field3, etc. )
Select field1, field2, field3, etc.
From tblTemp
Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'.
That was just an example of the SLQ statement you'll need to make a reference to Microsoft ActiveX Data Objects and do something like the following. Also unless you have a field called etc you'll have to drop that and list all the fields. Now this is not going to drop any records from the temp table so everytime you click command1 it is going to insert these records again into tblPerm, so you might want to run a delete query after the insert.
Private Sub Command1_Click()
Dim adoCmd As new ADODB.command
adoCmd.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=YourPathToTheAccessFile;User Id=YourUserName;Password=YourPassword;"
adoCmd.Commandtext = "Insert into tblPERM (DepDate, DepNo, Tenant, etc.) " & _
"Select DepDate, DepNo, Tenant, etc. " & _
"From tblTEMP "
adoCmd.execute
End Sub
Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'.
adoCmd.CommandText = "Delete From tblTEMP"
adoCmd.Execute
Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.