ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   urgent help needed please anyone (https://www.excelbanter.com/excel-programming/354150-urgent-help-needed-please-anyone.html)

Newbee[_2_]

urgent help needed please anyone
 
hello everyone as iam new to VB i have a small query which iam trying
to solve.
I have designed a form with three check boxes and one texbox which is
connected to a column in a table.

when i check one of the check boxes or all of them i want to copy the
checkbox label text to the textbox to store in the table. to achieve
this i defined a string in the on click event procedure of the CLOSE
Button on the form.

If i use this string in the on-click event procedure of the check box
its giving me this error "RUNTIME ERROR 2115". Thts the Reason i used
the string in the CLOSE command button (which doesnt give any runtime
error).

The problem comes when i click all the three check boxes the textbox is
only storing the recent value. but not all the three values. I have
attached the code please go through the string i have written in the
CLOSE Button event Procedure.

Comments.SetFocus
Dim options As String
options = Comments.Text
If chkCoverstory.Value = True Then
Comments.Text = Label3.Caption & options
If ChkNews.Value = True Then
Comments.Text = Label5.Caption & options
If ChkRegulars.Value = True Then
Comments.Text = Label7.Caption & options
End If

Any help is greatly appreciated. Thanks in advance.


Charlie

urgent help needed please anyone
 
Try:

Dim options As String

options = ""
If ChkCoverstory Then options = Label3.Caption
If ChkNews Then options = Label5.Caption & options
If ChkRegulars Then options = Label7.Caption & options
Comments.Text = options & Comments.Text


"Newbee" wrote:

hello everyone as iam new to VB i have a small query which iam trying
to solve.
I have designed a form with three check boxes and one texbox which is
connected to a column in a table.

when i check one of the check boxes or all of them i want to copy the
checkbox label text to the textbox to store in the table. to achieve
this i defined a string in the on click event procedure of the CLOSE
Button on the form.

If i use this string in the on-click event procedure of the check box
its giving me this error "RUNTIME ERROR 2115". Thts the Reason i used
the string in the CLOSE command button (which doesnt give any runtime
error).

The problem comes when i click all the three check boxes the textbox is
only storing the recent value. but not all the three values. I have
attached the code please go through the string i have written in the
CLOSE Button event Procedure.

Comments.SetFocus
Dim options As String
options = Comments.Text
If chkCoverstory.Value = True Then
Comments.Text = Label3.Caption & options
If ChkNews.Value = True Then
Comments.Text = Label5.Caption & options
If ChkRegulars.Value = True Then
Comments.Text = Label7.Caption & options
End If

Any help is greatly appreciated. Thanks in advance.



Newbee[_2_]

urgent help needed please anyone
 
hi charlie,

Thanks for the reply it works only when i click all the check boxes
when i click only one checkbox then it gives me a runtime error 4 '
Invalid use of null'. any suggestions.



All times are GMT +1. The time now is 08:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com