Refresh data on each record

A

Agnelo Fernandes

I have a form which has 2 check boxes: Invoice and Cheque.
If I tick 'cheque' then 'cheque number' and 'date' become visible.
and when I tick 'invoice' then 'invoice date' and 'invoice number' become
visible.
This works fine for me. However, suppose I tick 'invoice' in 1 record then
'invoice date' and 'invoice number' are visible not only on that particular
record also visible in the next record without we ticking 'invoice'.
How can I refresh each record in the form through VBA?
Thanks
 
M

March

I think you may need to have SQL statement

for example

sqlcmd = "Select * from tb where invoiceid = 'xxxxx';"
set xrst = db.openrecordset(sqlcmd)

I don't know how you display the record.
If you did show it as datarecordset in subform, you can use the sentence
below.

me.[your subform name].requery

I'm not sure this would help you or not.
 
K

Klatuu

You can use the form's current event to set the visiblity of the text boxes
based on the current value of the check boxes. For new records, you will
want to set them all to Visible = False.
 
J

John W. Vinson

I have a form which has 2 check boxes: Invoice and Cheque.
If I tick 'cheque' then 'cheque number' and 'date' become visible.
and when I tick 'invoice' then 'invoice date' and 'invoice number' become
visible.
This works fine for me. However, suppose I tick 'invoice' in 1 record then
'invoice date' and 'invoice number' are visible not only on that particular
record also visible in the next record without we ticking 'invoice'.
How can I refresh each record in the form through VBA?
Thanks

Consider using Conditional Formatting instead of tweaking the visible property
of the control. In a continuous form, it *looks* like there's a different
control for each record, but there really is only one - if you set the Visible
property of a control it applies to all the instances of that control.

Use Format... Conditional Formatting from the menu in form design view.
 

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

Top