Primary Key that Contains Number as a String & starting with zero

  • Thread starter cutepaloma405 via AccessMonster.com
  • Start date
C

cutepaloma405 via AccessMonster.com

I have two forms: frmFaculty and frmCourse. I have linked these two forms
through the FacultyID. When I open the frmCourse through the frmFaculty it
transfers the FacultyID because I given frmCourse OnCurrent the following
language:

If Me.NewRecord Then
[FacultyID].DefaultValue = Forms![Faculty]![FacultyID]
End If

My problem is that if the FacultyID is 094511 for some reason it does not
pick up the zero. This is odd because I made this field into a string.

Can someone help me in explaining how do I make the zero appear in the front
when I open the frmCourse?
Thank you!!
 
D

Daryl S

cutepaloma405 -

There can be a difference in a value and how it is displayed. Is the
FacultyID being stored correctly as a string in the Course table? Also, is
there formatting on the frmCourse control for the FacultyID?
 
C

cutepaloma405 via AccessMonster.com

Thank you for replying Daryl. There is no formatting on the frmCourse
control for the FacultyID. Actually the FacultyID started out as a number
field but I changed it into a string. I changed the FacultyID field into a
string on both the frmFaculty and frmCourse. Any ideas?

Daryl said:
cutepaloma405 -

There can be a difference in a value and how it is displayed. Is the
FacultyID being stored correctly as a string in the Course table? Also, is
there formatting on the frmCourse control for the FacultyID?
I have two forms: frmFaculty and frmCourse. I have linked these two forms
through the FacultyID. When I open the frmCourse through the frmFaculty it
[quoted text clipped - 11 lines]
when I open the frmCourse?
Thank you!!
 
J

J_Goddard via AccessMonster.com

Hi -

It may be because form controls don't have an explicit data type associated
with them, so the data is interpreted as numeric. Try forcing the control to
be a string, like this:

[FacultyID].DefaultValue = "'" & Forms![Faculty]![FacultyID] & "'"

HTH

John


Thank you for replying Daryl. There is no formatting on the frmCourse
control for the FacultyID. Actually the FacultyID started out as a number
field but I changed it into a string. I changed the FacultyID field into a
string on both the frmFaculty and frmCourse. Any ideas?
cutepaloma405 -
[quoted text clipped - 7 lines]
 
C

cutepaloma405 via AccessMonster.com

Who's the man?.....U!!! Thank you, thank you. It worked. I love this site!!
!! Have a really good day!!!!!

J_Goddard said:
Hi -

It may be because form controls don't have an explicit data type associated
with them, so the data is interpreted as numeric. Try forcing the control to
be a string, like this:

[FacultyID].DefaultValue = "'" & Forms![Faculty]![FacultyID] & "'"

HTH

John
Thank you for replying Daryl. There is no formatting on the frmCourse
control for the FacultyID. Actually the FacultyID started out as a number
[quoted text clipped - 6 lines]
 
D

Daryl S

Cutepaloma405 -

Try specifically making it a string, like this:

[FacultyID].DefaultValue = """" & Forms![Faculty]![FacultyID] & """"

--
Daryl S


cutepaloma405 via AccessMonster.com said:
Thank you for replying Daryl. There is no formatting on the frmCourse
control for the FacultyID. Actually the FacultyID started out as a number
field but I changed it into a string. I changed the FacultyID field into a
string on both the frmFaculty and frmCourse. Any ideas?

Daryl said:
cutepaloma405 -

There can be a difference in a value and how it is displayed. Is the
FacultyID being stored correctly as a string in the Course table? Also, is
there formatting on the frmCourse control for the FacultyID?
I have two forms: frmFaculty and frmCourse. I have linked these two forms
through the FacultyID. When I open the frmCourse through the frmFaculty it
[quoted text clipped - 11 lines]
when I open the frmCourse?
Thank you!!

--



.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top