Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Claim Tag Tracker - use next tag in new record

Claim Tag Tracker - use next tag in new record

Claim Tag Tracker - use next tag in new record

I have a database that is tracking items that are being checked in and out during a festival. Each item is tagged with a unique ID (ITM_2016_####) and plastic claim tag. I have a set list of claim tag IDs that can be assigned to items as they are entered into the system.
On a form I list each person who is checking in items then on a tabbed subform I enter the assigned tag ID and description of the item. I am trying to assign the next tag number in the series automatically and just can't get the database to do this.

I created a query that groups the remaining ID's and only shows the next one in the series and I can use this as the default value for the field, however when I add a second record it keeps the same tagID and doesn't refresh to the next one, it doesn't register that I just used the TagID.

Here is my basic structure:

tblOwners: strOwnerID | strOwnerFirst | strOwnerLast
tblTags: strTagID
tblAssignedTags: strTagID | strOwnerID | strItemDescription

Here is the query I am using to show the next TagID:

CODE -->

SELECT tblClaimTags.Claim_Tag_ID, Min(tblAvailableClaimTags.Claim_Tag_ID) AS MinOfClaim_Tag_ID
FROM tblAvailableClaimTags LEFT JOIN tblClaimTags ON tblAvailableClaimTags.Claim_Tag_ID = tblClaimTags.Claim_Tag_ID
GROUP BY tblClaimTags.Claim_Tag_ID
HAVING (((tblClaimTags.Claim_Tag_ID) Is Null))
ORDER BY Min(tblAvailableClaimTags.Claim_Tag_ID); 

I have a field on the subform (strNext) that pulls the value on the query: =DLookUp("MinOfClaim_Tag_ID","qryNextClaimTag")

I then tried to set the value of the new record to this field. I have tried adding the following code to the OnEnter property of the subform, the OnClick property of the subform, and the GotFocus property of the field and none of these work.

CODE -->

Private Sub Form_GotFocus()
If Nz(Claim_Tag_ID) Then

    Claim_Tag_ID = strNext

End If

End Sub 

Any help would be greatly appreciated.

RE: Claim Tag Tracker - use next tag in new record

strNext is the name of the field on the form that has the next ID?
If so try
Claim_Tag_ID = strNext.value

RE: Claim Tag Tracker - use next tag in new record

I tried putting .value but it still isn't working. Right now I have the code in the GoFocus event for the Claim_Tag_ID field...where is the right place for this to trigger

RE: Claim Tag Tracker - use next tag in new record

I added the following to the AfterUpdate property of the form...not sure which one works but it updates the strNext field when it goes to the new record.


So it fixed my problem...but not sure why.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close