By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,476 Members | 1,529 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,476 IT Pros & Developers. It's quick & easy.

Run code in report

P: n/a
Access2003
Me.txtMacpacNumber is an un-bound textbox on a report and
Me.txtRelease and Me.txtSplit are bound textboxes.

I was hoping to run this code in one of the report events but nothing
happens.
Any suggestions?
If Left(Me.txtRelease, 1) = "9" Then
Me.txtMacpacNumber.Value = "/S"
ElseIf Me.txtSplit = "000" Then
Me.txtMacpacNumber.Value = "/M"
Else
Me.txtMacpacNumber.Value = "/S"
End If

Thanks, RICK

Jan 11 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On 11 Jan 2006 14:47:40 -0800, 2D Rick wrote:
Access2003
Me.txtMacpacNumber is an un-bound textbox on a report and
Me.txtRelease and Me.txtSplit are bound textboxes.

I was hoping to run this code in one of the report events but nothing
happens.
Any suggestions?

If Left(Me.txtRelease, 1) = "9" Then
Me.txtMacpacNumber.Value = "/S"
ElseIf Me.txtSplit = "000" Then
Me.txtMacpacNumber.Value = "/M"
Else
Me.txtMacpacNumber.Value = "/S"
End If

Thanks, RICK


Why in an event?
Use your unbound control itself.

It appears the only values to be displayed will be either "/S" or
"/M"
As control source for [txtMacpacNumber], write:

=IIf([txtSplit] = "000","/M","/S")

The above assumes [txtSplit] is a Text datatype (as you indicate with
= "000").
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Jan 11 '06 #2

P: n/a
2D Rick wrote:
Access2003
Me.txtMacpacNumber is an un-bound textbox on a report and
Me.txtRelease and Me.txtSplit are bound textboxes.

I was hoping to run this code in one of the report events but nothing
happens.
Any suggestions?
If Left(Me.txtRelease, 1) = "9" Then
Me.txtMacpacNumber.Value = "/S"
ElseIf Me.txtSplit = "000" Then
Me.txtMacpacNumber.Value = "/M"
Else
Me.txtMacpacNumber.Value = "/S"
End If

Thanks, RICK

Why not make that a function. Call it GettxtMacpacNumber()

In the control source for txtMacpacNumber, enter
=txtMacpacNumber()

Jan 12 '06 #3

P: n/a
Thanks for the reply, It works as advertised.
Rick

Jan 12 '06 #4

P: n/a
Thanks for the reply, I had fredg's solution working before I read
yours.
I appreciate the time you took to answer.
Rick

Jan 12 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.