Formatting Custom MS Access Autonumbers as String

Results 1 to 3 of 3

Thread: Formatting Custom MS Access Autonumbers as String

  1. #1
    Join Date
    Dec 1969

    Default Formatting Custom MS Access Autonumbers as String

    I&#039;m creating an index page in ASP, using a MS Access 2002 database. The entries for the index include the primary key, which, in MS Access, is a specially formatted autonumber:<BR><BR>"AAOR-QIP-"000<BR><BR>The field name for this number is QIPNo. When I use the following on my ASP Page:<BR><BR>&#060;p&#062;&#060;a href="qips/&#060;%=(QIPs.Fields.Item("QIPNo").Value)%&#062;.d oc"&#062;&#060;%=(QIPs.Fields.Item("QIPNo").Value) %&#062;<BR><BR> &#060;%=(QIPs.Fields.Item("QIPTitle").Value)%&#062 ; &#060;/a&#062;&#060;/p&#062;<BR><BR>the resulting page simply shows the integer value (i.e., 1, 2, 3, etc.) rather than the formatted value (ex: AAOR-QIP-001, etc.).<BR><BR>How do I format this so that it appears correctly?<BR><BR>Thanks.<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default What does QIPNo contain?

    Just the 1, 2, 3? Or the whole string:<BR>AAOR-QIP-001<BR>AAOR-QIP-002<BR>AAOR-QIP-003<BR><BR>?<BR><BR>If it&#039;s just 1, 2, 3. Use this ASP code:<BR>&#060;%=Right("000" & QIPs("QIPNo"), 3) %&#062;

  3. #3
    Join Date
    Dec 1969

    Default Mixing up reporting with db contents

    An autonumber field *ALWAYS* contains ONLY a number. Period.<BR><BR>It just that you have built a report (or query?) in Access that tacks on your prefix.<BR><BR>But reports from Access do *NOT* carry over to SQL queries.<BR><BR>You&#039;ll have to tack the prefix on again.<BR><BR>You *could* put the prefix into another field in the table, of course. And that might be the smartest thing to do.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts