473,837 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing Data Type - Text to ReplicationID

I have two tables (tblClients and tblEmployees). Field [Counselor] in
tblClient uses the PK of tblEmployee as a lookup. Currently, the PK is

a text field containing the person's name.
I want to add a ReplicationID field, and make that the PK. I then need

to change the Counselor field in tblClient to store the ReplicationID
but show the Name, and not lose any data in the process.
Can anyone provide some help on how to do this, please? Boss wants
this project done by week's end, and this is my biggest stumbling
block.

Jan 5 '06 #1
4 2567
Bri


Blake D. wrote:
I have two tables (tblClients and tblEmployees). Field [Counselor] in
tblClient uses the PK of tblEmployee as a lookup. Currently, the PK is

a text field containing the person's name.
I want to add a ReplicationID field, and make that the PK. I then need

to change the Counselor field in tblClient to store the ReplicationID
but show the Name, and not lose any data in the process.
Can anyone provide some help on how to do this, please? Boss wants
this project done by week's end, and this is my biggest stumbling
block.


Is there a reason you aren't using an Autonumber field this new PK? You
shouldn't be using any of the special fields/datatypes that Replication
uses for your own use.

If you are using the Lookup feature of the Datasheet view of a Table,
they you would just need to modify the Combo settings. ColmnWidths is
the one that will hide the PK field:

Rowsource = SELECT myAutoID, EmployeeName FROM tblEmployees
BoundColumn = 1
ColumnCOunt = 2
ColumnWidths = 0;2
ListWidth = 2

You would be better off building a form rather than using a direct table
view in which case you would have a Combobox on the form that would do
the lookup and would be setup the same way. In fact, if you use the
wizard to create the combo, it will volunteer to hide the PK if you
select it and at least one other column.

--
Bri

Jan 5 '06 #2
I am using an Autonumber with type RepID. I should have clarified
that, sorry.

The tblClient is designed with the Counselor field being a ComboBox as
follows:
RowSource= SELECT tblEmployees.EM PLOYEES FROM tblEmployees WHERE
(((tblEmployees .COUNSELOR)=-1));
Bound Col = 1
ColumnCount = 1

I tried what you suggested, but the problem is the 2K records already
in place have text in the Counselor field (the counslor's name) instead
of the GUID being stored and just displaying the GUID (0") and Name
(2").

What I want to achieve is the Counselor Field in tblClients to be a
ComboBox as follows:
RowSource = SELECT tblEmployees.EM PLOYEE_GUID, tblEmployees.EM PLOYEES
FROM tblEmployees WHERE (((tblEmployees .COUNSELOR)=-1));
Bound Col = 1
ColumnCount = 2
Heads = 0
ColumnWidths = 0;2
ListWidth = Auto

Jan 5 '06 #3
"Blake D." <Bl****@Choctaw Recovery.com> wrote in
news:11******** **************@ g43g2000cwa.goo glegroups.com:
I want to add a ReplicationID field, and make that the PK.


Have you considered all the problems Access has with handling GUIDs?

See:

http://trigeminal.com/usenet/usenet011.asp?1033

I can't think of a proper use for them in any Access application of
any kind.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Jan 5 '06 #4
Bri

Blake D. wrote:
I am using an Autonumber with type RepID. I should have clarified
that, sorry.
Use either Long Integer with either Increment or Random. The RepID type
is for use by Replication. It is overkill to use it in a non-replicated
app as it is 16 bytes as compared to 4 bytes for a Long. Also, others in
this forem have indicated that there are other problems associated with
doing this.
The tblClient is designed with the Counselor field being a ComboBox as
follows:
RowSource= SELECT tblEmployees.EM PLOYEES FROM tblEmployees WHERE
(((tblEmployees .COUNSELOR)=-1));
Bound Col = 1
ColumnCount = 1

I tried what you suggested, but the problem is the 2K records already
in place have text in the Counselor field (the counslor's name) instead
of the GUID being stored and just displaying the GUID (0") and Name
(2").

What I want to achieve is the Counselor Field in tblClients to be a
ComboBox as follows:
RowSource = SELECT tblEmployees.EM PLOYEE_GUID, tblEmployees.EM PLOYEES
FROM tblEmployees WHERE (((tblEmployees .COUNSELOR)=-1));
Bound Col = 1
ColumnCount = 2
Heads = 0
ColumnWidths = 0;2
ListWidth = Auto


Here is a very good reason NOT to use the Replication ID type. You
cannot use it for any other field. First change your tblEmployees PK to
a Long Integer (as per my previous example I will assume it is named
myAutoID). Then create a NEW field in tblClients:
Name: CounselorID
Type: Long Integer
Default: 'remove the zero default
Indexed: Yes (Duplicates OK)

Then you need a query to populate this new field:
UPDATE tblClients INNER JOIN tblEmployees
ON tblClients.Coun selor = tblEmployees.Em ployees
SET tblClients.Coun celorID = [tblEmployees].[myAutoID]

Then if all went well you can delete the original Councelor field.

Then setup your Lookup (preferably in a Form not in the Table, I don't
know why MS even allows you to do it on a Table, it will cause you lots
of problems down the road).

--
Bri

Jan 6 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1808
by: Robert V | last post by:
Hi all, another area I could use some help with is changing submitted data based on the data conditions ... I will elaborate. I have a form textarea where a user can type in some text. This text is sent to a perl script that eventually will send that data to someone by email in HTML format. Here is where I need some help. If a user was to type in a web address www.mysite.com etc, in the text box, I would like my script to detect web...
1
6521
by: iporter | last post by:
Hi - I am changing a field from type nvarchar to type text, given that I need to store strings longer than 255 characters. To do this I change the data type in SQL Server, then I change the parameter code in the calling procedure, as per below: cmd.Parameters.Append(cmd.CreateParameter("@title", adVarWChar, adParamInput, 255, title)); becomes:
8
3197
by: Margaret MacDonald | last post by:
I'm a js novice trying to teach myself. I'm using Flanagan's 'Javascript, the definitive guide' from O'Reilly as a text. But either I'm dopier than usual or its layout doesn't match my learning style very well, because I seem to be having a dreadful time getting to grips with even the simplest things. Currently, I'm trying to change the text that follows a <p> element in a little test program. My test program has a table with two <td>...
7
6067
by: Stefan Finzel | last post by:
Hi, is there a way to change the display property on Windows Mobile 2003 SE Mobile/Pocket Internet Explorer? See following example. Please note: visibilty property has the same problem. Is there any other way to display/undisplay parts of web pages? TIA
31
4174
by: Greg Scharlemann | last post by:
Given some recent success on a simple form validation (mainly due to the kind folks in this forum), I've tried to tackle something a bit more difficult. I'm pulling data down from a database and populating a simple table. I'd like the table to contain 10 entries per page and have the option for the user to scroll through the pages of data without having to go back to refresh the page (I've already pulled all the info I need from the...
13
2924
by: Peter | last post by:
Can anyone tell me how to change the data type of a field in a table created with a make table query? The field is a binary and must be changed to text. alternately does anyone know how to specify the field type when running a make table query? Thanks, Sven
1
1331
by: Bill | last post by:
I'm need to be able to run a query that compares some time data. The problem is the format of the text. The text it being pulled from an ODBC source so I can't change the original data to match. One set of data is formatted to hh.mm (10.33) and the other is hhmmss (103400) I need to find a way to match the second format to the first. I've tired changing the field type in the table and it just drops needed information. Can anyone thing of a...
1
2653
by: peck2000 | last post by:
Related to my earleir post ... this is the same project to re-purpose the Classifieds application in BEGINNING ASP 3.0 (Wrox) to a comicbook database ... This is a brainteaser that should have been easy to resolve but just doesn't seem to work for me ... The original application includes a form page for editing the details of an "item". In my case the item is a comicbook. The page functions just fine as long as I stick with text fields, but I...
6
1390
scubak1w1
by: scubak1w1 | last post by:
.... will work on one page and yet not another... simplified for ease of reading, banging my head. I tried it using a response.text from an xmlHttp type "request" - would not alter the id='' I got the "clean" response.text as I poked it into a JS alert box to see it... so tried forcing it with a manual submit button using some nonense text - wil not change built a super simple change with a manual submit button - works!
0
10584
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10644
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10289
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9423
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7827
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7014
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4482
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3131
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.