puppygirl3939
Technical User
Please Help!!
I am new at VB code and I am following the instructions from a book. Line 3 (dim dbsA As database) returns the follwoing error: "Compile error:User-defined type not defined". Can someone please tell what am I doing wrong. The code is:
Private Sub County_Click()
Dim strregion As String
Dim dbsA As database
Dim recMain As Recordset
Set dbsA = CurrentDb
Set recMain = dbsA.OpenRecordset("Main"
End Sub
What I am trying to accomplish is to create a code where the user selects a county and it automatically enters the region in the region field. Both the county and the region are one to many tables and are subforms of the main form. Example form "Main" captures the company information subform "Counties" is where users select the number of "counties" that will receive the company information and subform "region" is populated base on the counties selected.
I am new at VB code and I am following the instructions from a book. Line 3 (dim dbsA As database) returns the follwoing error: "Compile error:User-defined type not defined". Can someone please tell what am I doing wrong. The code is:
Private Sub County_Click()
Dim strregion As String
Dim dbsA As database
Dim recMain As Recordset
Set dbsA = CurrentDb
Set recMain = dbsA.OpenRecordset("Main"
End Sub
What I am trying to accomplish is to create a code where the user selects a county and it automatically enters the region in the region field. Both the county and the region are one to many tables and are subforms of the main form. Example form "Main" captures the company information subform "Counties" is where users select the number of "counties" that will receive the company information and subform "region" is populated base on the counties selected.