Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check for no records in SQL - for a form

Status
Not open for further replies.

Darrylles

Programmer
Feb 7, 2002
1,758
GB
Hiya,

I don't want to use VB libraries for this - just VBA and forms.

I want to be able to say mycount = "sqlstatement that returns count of records from my complicated sql query that runs with no problems." (in VBA), and check for a null record count.

Forget DAO, ADO, etc - I know I can do it that way - I choose not to to avoid library issues across op. sys. changes.

Any ideas, with this limited info?

Thnx in advance for any ideas,

Darrylle



Never argue with an idiot, he'll bring you down to his level - then beat you with experience. darrylles@yahoo.co.uk
 
I suppose you could open a form and set its record source to the SQL. You could then check
If Forms!frmYourForm.RecordsetClone.RecordCount<> 0 Then

Duane
MS Access MVP
[green]Ask a great question, get a great answer.[/green]
[red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
[blue]Ask me about my grandson, get a grand answer.[/blue]
 
You may also take a look at the DCount function.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
DCount() would be easier to implement if you have a saved query of your "complicated sql".

Duane
MS Access MVP
[green]Ask a great question, get a great answer.[/green]
[red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
[blue]Ask me about my grandson, get a grand answer.[/blue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top