Move records from one table to a other table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hallo

I hope some i can help me i have a table full of access codes so i need a
query where i can say take the next 20 records out of that table and move
them to a diffrent table.

Regards
Markus
 
Markus

It isn't clear why you would need to move records from one table to another.
If you provide a description of "what" you are trying to do (rather than
"how"), the 'group's readers may be able to offer alternative approaches.

Regards

Jeff Boyce
<Access MVP>
 
Hi Jeff

Ok i will try to explain I have a program that sell phone cards on the phone
cards are secret pin numbers that the customer used to phone with at the
moment they are still physical cards with the number on in future the pin
numbers will be in a database and when i customer wants 10 cards (Pin
numbers) i want to insert them into a new table which will be emailed to the
customer and they import them into there local Software. And once the 10 Pin
numbers are in the new table i want to delete them of my records or flag them
as done but that i can do i just don't know how to tell a query give me from
this card the next 10 or 20 records.

I hope this helps
 
Look at using the TOP Predicate in your query.

SELECT TOP 10 PinNumbers, FieldB
FROM YourTable
ORDER BY PinNumbers, YourPrimaryKeyField
 
Thanks John

But the top needs to be changebile from a form i want to enter a QTY in a
form and it should then show me the query results with the top of the QTY i
entered how is this possible

Thank you

Markus
 
If you want to use the TOP property and have it change then you would have to
build the sql statement using VBA. The following alternative query MIGHT work.
No guarantees.

SELECT PinNumber
FROM YourTable
WHERE (Select Count(Tmp.PinNumber)
FROM YourTable As Tmp
WHERE tmp.PinNumber <= YourTable.PinNumber) <= Forms!YourFormname!YourControlName
 
Thank you John

John Spencer (MVP) said:
If you want to use the TOP property and have it change then you would have to
build the sql statement using VBA. The following alternative query MIGHT work.
No guarantees.

SELECT PinNumber
FROM YourTable
WHERE (Select Count(Tmp.PinNumber)
FROM YourTable As Tmp
WHERE tmp.PinNumber <= YourTable.PinNumber) <= Forms!YourFormname!YourControlName
 
Back
Top