I have a field Class. When I enter the Class number and press enter first entry in the next Field (CageNo) is recorded as 1. Enter the same Class press enter again and the next EntryNo is 2. The following is how I achieve this at present using a query and an update query.
' Get ExhibitorID from [Forms]![ Entry Form]![ExhibitorID] and put into [Forms]![Entry Form]![Bird Entry SubForm]![Bird Entry SubForm]![ExhibitorID]
Forms![Entry Form]![Bird Entry SubForm]!ExhibitorID = Forms![Entry Form]!ExhibitorID
' Open Total In Class Form Window mode is Hidden
DoCmd.OpenForm "Total in Class Form", acNormal, "", "", , acHidden
' Get value form [Forms]![Total In Class]![NumberInClass] and put into [Forms]![Entry Form]![Bird Entry SubForm]![CageNo]
Forms![Entry Form]![Bird Entry SubForm]!CageNo = Eval("[Forms]![Total in Class Form]![NumberinClass]")
' Close Total In Class Form
DoCmd.Close acForm, "Total in Class Form"
' Turn off warnings about updating
DoCmd.SetWarnings False
' UpGrade CageNo +1 Query to next cage number
DoCmd.OpenQuery "Update CageNo +1 Query", acViewNormal, acEdit
' Close update Query
DoCmd.Close acQuery, "Update CageNo +1 Query"
This works okay but sometines a wrong CageNo has appeared. I was wondering if someone could help with VBA code to achieve the same result. Thanks
' Get ExhibitorID from [Forms]![ Entry Form]![ExhibitorID] and put into [Forms]![Entry Form]![Bird Entry SubForm]![Bird Entry SubForm]![ExhibitorID]
Forms![Entry Form]![Bird Entry SubForm]!ExhibitorID = Forms![Entry Form]!ExhibitorID
' Open Total In Class Form Window mode is Hidden
DoCmd.OpenForm "Total in Class Form", acNormal, "", "", , acHidden
' Get value form [Forms]![Total In Class]![NumberInClass] and put into [Forms]![Entry Form]![Bird Entry SubForm]![CageNo]
Forms![Entry Form]![Bird Entry SubForm]!CageNo = Eval("[Forms]![Total in Class Form]![NumberinClass]")
' Close Total In Class Form
DoCmd.Close acForm, "Total in Class Form"
' Turn off warnings about updating
DoCmd.SetWarnings False
' UpGrade CageNo +1 Query to next cage number
DoCmd.OpenQuery "Update CageNo +1 Query", acViewNormal, acEdit
' Close update Query
DoCmd.Close acQuery, "Update CageNo +1 Query"
This works okay but sometines a wrong CageNo has appeared. I was wondering if someone could help with VBA code to achieve the same result. Thanks