checkboxes unchecking in VB code

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

Guest

Dear Sirs

I have a VB code which is executing appen-,deletequeries and is printing a
report.
To run this code I have to check upfront a checkbox – either yearlypayment
or halfyearpayment. After the code ran the checkbox is still checked. I would
like the checkbox automatically unchecking, after the VB code ran. Is this
possible with another line in the VB code and if yes, how?
This is my code:

Private Sub cmdPrintbill_Click()
Dim stDocName As String

CurrentDB.Execute "billyearlyhelpappendquery", dbFailOnError
CurrentDB.Execute "billhalfyearhelpappendquery", dbFailOnError
CurrentDB.Execute "billsappendquery", dbFailOnError
CurrentDB.Execute "openbillsappendquery", dbFailOnError
DoCmd.OpenReport "billingcemetery", acViewNormal
CurrentDB.Execute "billingtabledeletequeryquery", dbFailOnError

End Sub


Thanks
Klaus
 
Well you could end your code with(before the end sub): me.checkbox=false
Where checkbox is the name of your checkbox.

Maurice
 
The checkboxes are on a subform how can I write the code correct.
Somehow I have to show where the textbox is 8something like):
me.[billinghalfyear].halfyearpayment = False
but that's not working.
Can you tell me how it is correct?
Thanks
Klaus
 
Is your code running from the subform or the main form?
You may need the code to read

Forms!frmMainForm!sfrmSubform.forms!CheckBox = False

Hope this helps.

Amateur said:
The checkboxes are on a subform how can I write the code correct.
Somehow I have to show where the textbox is 8something like):
me.[billinghalfyear].halfyearpayment = False
but that's not working.
Can you tell me how it is correct?
Thanks
Klaus

Maurice said:
Well you could end your code with(before the end sub): me.checkbox=false
Where checkbox is the name of your checkbox.

Maurice
 
the checkboxes are on a subform and should be cleared there - but I don't
understand what you are saying.
Maybe you can specify with the details I am giving now.
My subform is called "billinghalfyear" the checkbox is called
"halfyearpayment" - How does it has to look?

Forms!frmofferandbill!sfrmbillinghalfyear.forms!halfyearpayment = False

like this it's not working, can you help?
Thanks
Klaus


Jackie L said:
Is your code running from the subform or the main form?
You may need the code to read

Forms!frmMainForm!sfrmSubform.forms!CheckBox = False

Hope this helps.

Amateur said:
The checkboxes are on a subform how can I write the code correct.
Somehow I have to show where the textbox is 8something like):
me.[billinghalfyear].halfyearpayment = False
but that's not working.
Can you tell me how it is correct?
Thanks
Klaus

Maurice said:
Well you could end your code with(before the end sub): me.checkbox=false
Where checkbox is the name of your checkbox.

Maurice

:

Dear Sirs

I have a VB code which is executing appen-,deletequeries and is printing a
report.
To run this code I have to check upfront a checkbox – either yearlypayment
or halfyearpayment. After the code ran the checkbox is still checked. I would
like the checkbox automatically unchecking, after the VB code ran. Is this
possible with another line in the VB code and if yes, how?
This is my code:

Private Sub cmdPrintbill_Click()
Dim stDocName As String

CurrentDB.Execute "billyearlyhelpappendquery", dbFailOnError
CurrentDB.Execute "billhalfyearhelpappendquery", dbFailOnError
CurrentDB.Execute "billsappendquery", dbFailOnError
CurrentDB.Execute "openbillsappendquery", dbFailOnError
DoCmd.OpenReport "billingcemetery", acViewNormal
CurrentDB.Execute "billingtabledeletequeryquery", dbFailOnError

End Sub


Thanks
Klaus
 

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

Similar Threads

VB code 1
Append Queries, table, sql command 4

Back
Top