records in subform

mu

Registered User.
Local time
Today, 19:36
Joined
May 22, 2002
Messages
18
Hi everyone

I am creating a form that will allow me to allocate payments against purchase invoices, the account is selected via a combobox in the main form and the invoices are listed via a continuous subform. I have got the form working mostly how I want it to but I am having big trouble with one aspect.

If I want to post a payment to an account that has not yet had an invoice posted, ie a payment on account, the subform obviously has no records to set payments against.

What I want to do is when i click the payinvoicebutton I want to check if the subform has any records for the selected account - if not my idea is to post the payment on account via some form of message/text boxes.

I suspect it may have something to do with recordsets but as yet I have not worked them out.

Hope someone can help

Thanks

MU
 
Try this:

dim dbs as database
dim rst as recordset
dim response as integer

set dbs = currentdb()
set rst = forms!YourMainForm!YourSubform.form.recordsetclone

if rst.recordcount = 0 then

response = msgbox("There are no invoices against which to post this payment. Do you want to post a payment on account?" ,vbyesno)

If response = vbyes then
do something

else
do something else

end if

HTH
 
Thanks Elana

Works great.:D
 

Users who are viewing this thread

Back
Top Bottom