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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dummy value to field not included in Recordsource? 1

Status
Not open for further replies.

ponderdj

MIS
Dec 10, 2004
135
US
Hello,

I would like to know if there's a way to assign a dummy value to a field that is on the report, but may or may not be in the report's recordsource. Why do I want to know this?

Because, I have successfully built the code on a form to open the report, then the report checks to see if the form is loaded, if so it checks the controls that are enabled on the form and assigns itself a recordsource that uses the values in those controls. (Based on if, thens and a SQL String) But, there are 5 fields on the form, and if the recordsource it uses doesn't select all 5 fields (which it shouldn't sometimes when that control on the form isn't enabled) it prompts me for the value of those unincluded fields. Is there a way I can assign them a dummy value?

Thanks,
David
 
Hi

Would using something like

If IsNull(MyField) Then
strSQL = "SELECT ... "MyDefault" As MyField,...
Else
strSQL = "SELECT ... MyField,....
End If

be what you mean?

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Ken,

Yes, almost unbelievably it was that simple. For some reason I was thinking like an insert query and trying

VALUE "MyDefault" AS MyField

Thanks!
David
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top