fearmichaele
Registered User.
- Local time
- Today, 09:38
- Joined
- Jan 14, 2014
- Messages
- 34
[FONT="]I have created a database that takes one query that has a blank field in a predetermined field and finds a record in a second query that matches name and date of birth criteria. it pulls the value into the blank field that is supposed to be there.
MR missing in query one....find record in query two that matches additional predetermined variables and pull MR from query two and add to query one.
I have a cumbersome VBA that accomplishes this but after every 19 records i get error message pop up that says "run-time error 28 out of stack space"
I have search all of the forums and have not found a viable solution. there is my code. to set up the scenario i have a form that i open first. using Onload the form opens a query and another form for that query where it has found the matching record. the second form that is opened uses this code where the error occurs.[/FONT]
[FONT="]Private Sub Form_Load()
On Err GoTo errhand
Dim mr As String
Dim queryname As String
Dim dbs As DAO.Database
Dim rec1 As DAO.Recordset
DoCmd.Close acForm, "blank MRN Records", acSaveNo
Set dbs = CurrentDb
queryname = "refill_Requests Query"
Set rec1 = dbs.OpenRecordset(queryname) ' dbOpenDynaset, dbSeeChanges)
mr = Me.FTMedRecNo
rec1.Edit
rec1("Patient MRN") = mr
rec1.Update
rec1.Close
DoCmd.Close acQuery, "mmdblist", acSaveYes
DoCmd.Close acForm, "mmdblist", acSaveNo
DoCmd.OpenForm "blank MRN Records", acNormal
errhand:
Err.Clear
DoCmd.Close acQuery, "mmdblist", acSaveYes
DoCmd.Close acForm, "mmdblist", acSaveNo
DoCmd.OpenForm "blank MRN Records", acNormal
End Sub[/FONT]
[FONT="]my on error doesn't catch error 28 because it stops mid code.
the procedure works well for 19 records then boom it stops.
I have currently a total of 3500 records to repair with a MR. how can i get this to run all the way to the end without causing error 28?[/FONT]
MR missing in query one....find record in query two that matches additional predetermined variables and pull MR from query two and add to query one.
I have a cumbersome VBA that accomplishes this but after every 19 records i get error message pop up that says "run-time error 28 out of stack space"
I have search all of the forums and have not found a viable solution. there is my code. to set up the scenario i have a form that i open first. using Onload the form opens a query and another form for that query where it has found the matching record. the second form that is opened uses this code where the error occurs.[/FONT]
[FONT="]Private Sub Form_Load()
On Err GoTo errhand
Dim mr As String
Dim queryname As String
Dim dbs As DAO.Database
Dim rec1 As DAO.Recordset
DoCmd.Close acForm, "blank MRN Records", acSaveNo
Set dbs = CurrentDb
queryname = "refill_Requests Query"
Set rec1 = dbs.OpenRecordset(queryname) ' dbOpenDynaset, dbSeeChanges)
mr = Me.FTMedRecNo
rec1.Edit
rec1("Patient MRN") = mr
rec1.Update
rec1.Close
DoCmd.Close acQuery, "mmdblist", acSaveYes
DoCmd.Close acForm, "mmdblist", acSaveNo
DoCmd.OpenForm "blank MRN Records", acNormal
errhand:
Err.Clear
DoCmd.Close acQuery, "mmdblist", acSaveYes
DoCmd.Close acForm, "mmdblist", acSaveNo
DoCmd.OpenForm "blank MRN Records", acNormal
End Sub[/FONT]
[FONT="]my on error doesn't catch error 28 because it stops mid code.
the procedure works well for 19 records then boom it stops.
I have currently a total of 3500 records to repair with a MR. how can i get this to run all the way to the end without causing error 28?[/FONT]