Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code failing

Status
Not open for further replies.

CrystalStart

IS-IT--Management
Feb 3, 2005
185
US
I am running code

If Forms![Update_master-data-charges]!txt_Check_Dates.Value = True Then

MsgBox "Data for this Pay Period is exists in the master-data-charge table"

Else
DoCmd.RunMacro "Run_Update_master-data-charges"
DoCmd.Close acForm, "Update_master-data-charges", acSaveYes
DoCmd.OpenForm "Run_Delinquent_By_EC_Member_Report"

End If

and it is running all DoCmds anyway whether txt_Check_Dates has value or not.

Please help
 
The .value property is referring to the information that has been entered into the text box(if any). It is not a boolean operator and does mean that your text box actually has a value. If you are just trying to make sure that the text box is not blank you can try something like this;
If (Not IsNull(me.txt_Check_Dates)) And (me.txt_Check_Dates <> "") Then
On the other hand, if you are actually trying to see if the user has entered the word True then you need to have "True" in quotes since it is a reserved word in VBA.
Hope this helps.
 
Is txt_Check_Dates a checkbox ?
Have you trapped the different values ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
txt_Check_Dates is a textbox placed on form so if it has value - err message should appear.
txt_Check_Dates RowSource is a query.If it is empty - go ahead run code.

Thanks
 
A TextBox has no RowSource property. I guess you meant ControlSource.
Try this:
If Trim(Forms![Update_master-data-charges]!txt_Check_Dates & "") <> "" Then

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
When F8 through txt_Check_Dates is showing Null value even it does have value.
I've changed it to list box - the same thing.
I ran into this before, so I use to keep box Selected all the time so it is like being "noticed" but for now I can't keep it Selected.
So is there sure way to read in listbox or textbox.
It does not matter - I can use either.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top