Unbound form question!

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

Guest

I have a unbound form, that contains unbound text box, and 2 buttons.
The txtLoanNumber
The first button is to print report rptInvoice based on the Loan Number in
the txtLoanNumber
the 2nd button is to delete a record from the table tblDetAccount based on
the txtLoanNumber

When a person presses print, I would like it to tell the user that you are
about to print [Count how many records are equal to txtLoannumber], if the
record does not exist, inform the user that, the Record xxxxxx is not in the
database

How do I code it so that it deletes the record where the loan number is
equal to txtLoannumber. It should be able to inform the user that there are
[count of records] in the database that match the Loan number entered.
 
To count records in a table, use the DCount() function.

For example:

dim x as long
x = dcount("*", "[MyTable]", "[MyField]=99")
msgbox "There are " & x & " records in table [MyTable] where the
value of [MyField] is 99"

Check it out in F1 help.

HTH,
TC (MVP Access)
http://tc2.atspace.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top