alastair69
Registered User.
- Local time
- Today, 11:13
- Joined
- Dec 21, 2004
- Messages
- 562
I have a a SQL statement that clear out the data to replace it with random records, i need to set a criteria to look at a form and use a field to limit the number of records returned, i can do this manually but it is a pain to have to do it each time i run the Sql statement.
I have enclosed a copy of the sql code and will include field & form names to help.
[ContactType] = Calls Today or General Contacts plus others.
SQL CODE:-
strSQL = "SELECT TOP " & strTopVal & " ClientLookUp,ClientID, Address1LookUp, Address2LookUp,Address3LookUp,Address4LookUp," & _
" PostCode, Classification, ContactName, ContactPhone,ContactFax,WebAddress,Owner,Lab,Contractor,AccountRef,Status,TermsAgreed," & _
" ContactType,AccountManager FROM [JT Client List] " & _
" ORDER BY RandomNumber([ClientID]);"
Debug.Print strSQL
db.QueryDefs.Delete "qry Random Clients Temp"
Set qdf = db.CreateQueryDef("qry Random Clients Temp", strSQL)
I Like the success of this forum people seem happy to help, I have even managered to help peopl.
Alastair
I have enclosed a copy of the sql code and will include field & form names to help.
[ContactType] = Calls Today or General Contacts plus others.
SQL CODE:-
strSQL = "SELECT TOP " & strTopVal & " ClientLookUp,ClientID, Address1LookUp, Address2LookUp,Address3LookUp,Address4LookUp," & _
" PostCode, Classification, ContactName, ContactPhone,ContactFax,WebAddress,Owner,Lab,Contractor,AccountRef,Status,TermsAgreed," & _
" ContactType,AccountManager FROM [JT Client List] " & _
" ORDER BY RandomNumber([ClientID]);"
Debug.Print strSQL
db.QueryDefs.Delete "qry Random Clients Temp"
Set qdf = db.CreateQueryDef("qry Random Clients Temp", strSQL)
I Like the success of this forum people seem happy to help, I have even managered to help peopl.
Alastair