473,396 Members | 2,037 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Modify Control Source Expression for change in field type

4
I'm using the access template for Issue Tracking and making small modifications for my needs. One thing I did is change the ID field type from a number to a text and when I did that the below expression in one of the forms will no longer work:
Expand|Select|Wrap|Line Numbers
  1. =ColumnHistory([RecordSource],"Comments","[ID]=" & Nz([ID],0))
How can I modify this so it works with the "ID" field being text now instead of a number?
Jan 10 '20 #1

✓ answered by twinnyfo

MRenee,

First, Welcome to Bytes!

MRenee:
One thing I did is change the ID field type from a number to a text
You should never change a Field Data Type after there is data in it (especially a field named "ID").

MRenee:
when I did that the below expression in one of the forms will no longer work:
Expand|Select|Wrap|Line Numbers
  1. =ColumnHistory([RecordSource],"Comments","[ID]=" & Nz([ID],0))
This is no surprise.

I can hepp you get it to work this way:
Expand|Select|Wrap|Line Numbers
  1. =ColumnHistory([RecordSource],"Comments","[ID]='" & Nz([ID],0) & "'")
However, this does not address the issues you are having with why you would need to change an ID field to text. This is simply a poor design change, and one that will probably produce more challenging problems yonder down the road.

Hope this hepps!

8 1669
twinnyfo
3,653 Expert Mod 2GB
MRenee,

First, Welcome to Bytes!

MRenee:
One thing I did is change the ID field type from a number to a text
You should never change a Field Data Type after there is data in it (especially a field named "ID").

MRenee:
when I did that the below expression in one of the forms will no longer work:
Expand|Select|Wrap|Line Numbers
  1. =ColumnHistory([RecordSource],"Comments","[ID]=" & Nz([ID],0))
This is no surprise.

I can hepp you get it to work this way:
Expand|Select|Wrap|Line Numbers
  1. =ColumnHistory([RecordSource],"Comments","[ID]='" & Nz([ID],0) & "'")
However, this does not address the issues you are having with why you would need to change an ID field to text. This is simply a poor design change, and one that will probably produce more challenging problems yonder down the road.

Hope this hepps!
Jan 10 '20 #2
MRenee
4
Thanks I'll give that a shot.
Jan 13 '20 #3
twinnyfo
3,653 Expert Mod 2GB
Let us know how things turn out.
Jan 13 '20 #4
MRenee
4
That worked, thank you so much!!
Jan 13 '20 #5
twinnyfo
3,653 Expert Mod 2GB
Glad we could be of service. Let us know if you need any more hepp!
Jan 13 '20 #6
MRenee
4
Ok, so that did break other things in the form that I didn't think would be affected by this code. So let me expand on what I'm wanting to do.
I changed the data type of the ID field because I want to be able to enter the ID in this manner 2019-01, 2019-02, 2019-03. The expression in the form tracks the history of comments that you enter in a comment box and I want to maintain that functionality. So how can I retain the comment history tracking function but also have the ID in the format that I want?
Jan 13 '20 #7
twinnyfo
3,653 Expert Mod 2GB
I would recommend maintaining the ID as a numerical value (an auto-incrementing long integer) and have a separate field for the "CommentID" which have whatever format you design.

Some additional thoughts: if you are simply recording the number of comments per year (as it appears), what happens if you exceed 99 comments? In this case, simply having a date field that records the Date/Time of the comment is all you need. Then, simply list all the comments from 2019, for example.

I recognize that there may be much more going on than what that simplistic response may address. However, the key principle I would like you to embrace is that if you have an ID, the best way to do it is with an auto-incrementing field. You can design your CommentID or CustomerID, etc., however you wish. But the unique identifier for the record should be the simplest, easiest to manage. There are countless advantages to this method.

Hope this hepps!

Standing by to respond to any additional thoughts on this.
Jan 13 '20 #8
NeoPa
32,556 Expert Mod 16PB
MRenee:
So let me expand on what I'm wanting to do.
Please don't. That isn't how this site is best used nor is it compatible with our rules.

What you should do is post a separate question, optionally with a link back to this one if you believe it may help (or even hepp ;-)).

Generally speaking long and multi-problem threads are complicated and hard to follow. This causes them to be of little value to all those out there with similar problems. So far we have a thread with a straightforward question and a matching answer post selected. That's great. Continuing to use this thread for other questions merely muddies the waters and leaves much valuable intelligence hard to find or discern.
Jan 14 '20 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Sharon | last post by:
I've had an Access 2000 app running successfully for many months on both Windows XP and Windows 2000. Recently when my Windows 2000 users call a particular report, they get first a dialog...
5
by: Cro | last post by:
Hello Access Developers, I'd like to know if it is possible to perform a count in an expression that defines a control source. My report is based on a query. In my report, I want a text box to...
4
by: VivN | last post by:
I want to use an expression as the control source for a text box in a report (Access 2000). Whilst I have sucessfully used these simple ones =TimeToSingle(TotalHours(,))...
4
by: Bruce Skamser | last post by:
I added a field to a table and when I go to the form to add a textbox control, I can't bind it to the field in the table. It doesn't come up in the list of fields in the control source dropdown. ...
4
by: Anja | last post by:
Hi everyone, I am trying to use the expression builder to create input to a control in an Access report. I have a table called Records and I want to select the minimum date for a record where...
8
by: mlwerth | last post by:
Dear Access Group: This is the most basic and most embarrassing of questions, but I cannot find where to change the data type of a text field that I have in Access 2003 to a number field. I've...
24
angus macgyver
by: angus macgyver | last post by:
hi, i have a simple database that maintains customer info in one table and their orders in another. when adding a new order for a customer i would like the customer name and id at the top of the...
10
by: rudycortez2 | last post by:
I am building a data base for training, I want to be able to have a control source on a field in a form along with an expression for the field,The expression im using is "DateAdd("interval",Number,)....
2
Seth Schrock
by: Seth Schrock | last post by:
I haven't tried anything yet, but I was wondering if anyone else has. I'm wanting to concatenate several fields together along with static text and I want the ability to change the arrangement of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.