I'm currently working on a form for a hiring plan. Basically it works from a form of information that is inputed. A text box will be filled with the number of hires that are needed. I need to populate the four sites for the year based on priority. This is what I have so far. I also have a table with the start dates for each hire class. I need to get it to loop and fill in the dates.

Private Sub txt_hiresneeded_AfterUpdate()

Dim db As Database
Dim frm As Form
Dim rec As Recordset
Dim mySQL As String

'Below are calculated values
Dim HireCapacity As Double
Dim StationCapacity As Double
Dim TrainingCapacity As Double
Dim OpenStations As Double
Dim SiteHires As Double

'These values are pulled from a table or form
Dim StatMultiplier As Double
Dim TtlStations As Double
Dim StationsInUse As Double
Dim TraineesPerClass As Double
Dim MaxClasses As Double
Dim HiresNeeded As Double

Set db = CurrentDb
Set frm = Forms!frm_HireCapacity

mySQL = "SELECT tbl_x65_sites.[Site Name], tbl_x65_sites.[Priority Code], tbl_x65_sites.[Stations], tbl_x65_sites.[Stations in use], tbl_x65_sites.[St Utiliz multiplier], tbl_x65_sites.[Class size limiter], tbl_x65_sites.[Training class limiter] FROM tbl_x65_sites WHERE (((tbl_x65_sites.[Priority Code])=1))"
Debug.Print mySQL

Set rec = db.OpenRecordset(mySQL)
StatMultiplier = rec![St Utiliz multiplier]
TtlStations = rec![Stations]
StationsInUse = rec![Stations in use]
TraineesPerClass = rec![Class size limiter]
MaxClasses = rec![Training Class limiter]

OpenStations = TtlStations - StationsInUse
StationCapacity = OpenStations * StatMultiplier
TrainingCapacity = TraineesPerClass * MaxClasses

If TrainingCapacity > StationCapacity = True Then HireCapacity = StationCapacity Else HireCapacity = TrainingCapacity
frm.txt_OneSite = rec![Site Name]
frm.txt_OneSiteCapacity = HireCapacity

HiresNeeded = frm.txt_hiresneeded
If HiresNeeded < HireCapacity = True Then SiteHires = HiresNeeded Else SiteHires = HireCapacity
frm.txt_OneSiteHires = SiteHires


End Sub