473,394 Members | 1,737 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,394 software developers and data experts.

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 2527
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.EMPLOYEES 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.EMPLOYEE_GUID, tblEmployees.EMPLOYEES
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****@ChoctawRecovery.com> wrote in
news:11**********************@g43g2000cwa.googlegr oups.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.EMPLOYEES 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.EMPLOYEE_GUID, tblEmployees.EMPLOYEES
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.Counselor = tblEmployees.Employees
SET tblClients.CouncelorID = [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
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...
1
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...
8
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...
7
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...
31
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...
13
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...
1
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....
1
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...
6
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...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...
0
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...

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.