Access.2007.VBA.Bibl..

(John Hannent) #1
Assign the appropriate form as the subform’s source object.

Me![subNewJobs].SourceObject = “fsubNewJobs”

End Select

ErrorHandlerExit:
Exit Sub

ErrorHandler:
MsgBox “Error No: “ & Err.Number _
& “; Description: “ & Err.Description
Resume ErrorHandlerExit

End Sub

The “Save New Jobs to Table” button’s event procedure sets up a Select Casestatement to run
one of three append queries to append the new Jobs data to the tblJobs table:

Private Sub cmdSaveJobs_Click()

On Error GoTo ErrorHandler

DoCmd.SetWarnings False

intFileType = Nz(Me![fraFileType].Value, 1)

Select Case intFileType

Case 1

dBASE

DoCmd.OpenQuery “qappNewJobsDB”

Case 2

Paradox

DoCmd.OpenQuery “qappNewJobsPdox”

Case 3

Lotus 1-2-3

DoCmd.OpenQuery “qappNewJobsLotus”

End Select

Part II Writing VBA Code to Exchange Data between Office Components

Free download pdf