 |
JLRodgers Level: Moderator
 Registered: 04-04-2002 Posts: 1617
|
Re: Call Display for recordset data not working
Actually there is no:
OpenCompSoftTable
DisplayCompSoftData
InitialiseCompSoftData
CloseCompSoftTable
Since you put Call x (where x = something from the list) I'd have to assume you've left out some important routines from your code.
|
|
12-09-2002 at 07:39 PM |
|
|
Nmacp Level: Guest

|
Re: Call Display for recordset data not working
Hi
From the module code the record set CompSoft is Public see below. The coding for the rsEmployee works fine ic an add records and edit them. On comparing rsEmployee with the rsCompSoft the coding for rsCompSoft looks ok. I can't figure out why it's saying that sub or function not defined. Thanks, Nicolla.
Option Explicit
Public dbSoftware As Connection
Public rsCompSoft As Recordset
Public rsEmployee As Recordset
Public rsEmployeeSubs As Recordset
Public CurrentEmployee As Long 'by definition the autonumber is long thats why you make it a long'
Sub Main()
frmUpdateApp.Show
End Sub
Sub InitialiseEmployeeData()
frmUpdateEmployee.txtEmployeeID = ""
frmUpdateEmployee.txtFirstName = ""
frmUpdateEmployee.txtLastName = ""
End Sub
Sub InitialiseCompSoftData()
frmUpdateSoftware.txtSoftwareID = ""
frmUpdateSoftware.txtSoftwareName = ""
End Sub
Sub DisplayEmployeeData()
frmUpdateEmployee.txtEmployeeID = rsEmployee("EmployeeID")
frmUpdateEmployee.txtFirstName = rsEmployee("FirstName")
frmUpdateEmployee.txtLastName = rsEmployee("LastName")
End Sub
Sub DisplaySoftwareData()
frmUpdateSoftware.txtSoftwareID = rsCompSoft("SoftwareID")
frmUpdateSoftware.txtSoftware Name = rsCompSoft("Software Name")
End Sub
Sub DisplaySoftUsersData()
frmUpdateSoftwareUser.txtEmployeeID = rsEmployee("EmployeeID")
frmUpdateSoftwareUser.txtLastName = rsEmployee("LastName")
frmUpdateSoftwareUser.txtFirstName = rsEmployee("FirstName")
frmUpdateSoftwareUser.txtSoftwareID = rsSoftware("SoftwareID")
frmUpdateSoftwareUser.txtSoftwareID = rsSoftware("SoftwareID")
Call OpenEmpSoftSubsQuery 'Opens a query from the database SQL'
If rsEmpSoftSubs.RecordCount > 0 Then 'means that an employee record is greater than 0 an enrollment is found'
frmUpdateSoftwareUser.txtEmployed = "Yes"
CurrentEnrol = rsEmpSoftSubs("Enrol Sequence") 'Saved the sequence'
frmUpdateSoftwareUser.cmdChangeEmployed.Caption = "Delete Employed"
Else
frmUpdateSoftwareUser.txtEmployed = "No" 'if no add a caption add Employed'
frmUpdateSoftwareUser.cmdChangeEmployed.Caption = "Add Employed"
End If
Call CloseEmpSoftSubsQuery
End Sub
Sub WriteEmployeeData()
rsEmployee("EmployeeID") = frmUpdateEmployee.txtEmployeeID
rsEmployee("Last Name") = frmUpdateEmployee.txtLastName
rsEmployee("First Name") = frmUpdateEmployee.txtFirstName
End Sub
Sub WriteCompSoftData()
rsCompSoft("SoftwareID") = frmUpdateSoftware.txtSoftwareID
rsCompSoft("Software Name") = frmUpdateSoftware.txtSoftwareID
End Sub
Sub OpenCompSoftTable()
rsCompSoft.Open "CompSoft", _
dbSoftware, adOpenStatic, adLockOptimistic, adCmdTableDirect
End Sub
Sub OpenEmployeeTable()
rsEmployee.Open "Employee", _
dbSoftware, adOpenStatic, adLockOptimistic, adCmdTableDirect
End Sub
Sub OpenEmpSoftQuery()
Dim SQLStr As String
SQLStr = "SELECT * FROM [SoftwareUsers] " & _
"WHERE [EmployeeID] = '" & rsEmployees("EmployeeID") & "' " & _
"AND [SoftwareID] = '" & rsCompSoft("SoftwareID") & "'"
rsEmployee.Open SQLStr, _
dbSoftware, adOpenStatic, adLockOptimistic
End Sub
Sub OpenDatabase()
Set dbSoftware = New ADODB.Connection
dbSoftware.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=Software.mdb;"
Set rsCompSoft = New Recordset 'set means create objects but do nothing with them'
Set rsEmployee = New Recordset
Set rsEmployeeSubs = New Recordset
End Sub
Sub CloseEmployeeTable()
rsEmployee.Close
End Sub
Sub CloseCompSoftTable()
rsCompSoft.Close
End Sub
Sub CloseEmpSoftQuery()
rsEmpSoft.Close
End Sub
Sub CloseDatabase()
dbSoftware.Close
Set dbSoftware = Nothing 'removes object from memory'
Set rsCompSoft = Nothing
Set rsEmployee = Nothing
Set rsEmployeeSubs = Nothing
End Sub
|
|
13-09-2002 at 11:21 PM |
|
|  |
|
|
JLRodgers Level: Moderator
 Registered: 04-04-2002 Posts: 1617
|
Re: Call Display for recordset data not working
If you turn off the "Enable emoticons in this post?" your code will look better.
You don't have a: DisplayCompSoftData
you do have a:
DisplaySoftwareData
DisplayEmployeeData
DisplaySoftUsersData
Oh and for two comments (not important for it not working or anything):
1) It looks as if most of the "public" routines you have in the module could easily be in 2 forms, since you're referencing them from it.
2) Put "Private|Public" (either, Public in your case) in front of the Sub.
[Edited by JLRodgers on 14-09-2002 at 03:37 PM GMT]
|
|
14-09-2002 at 09:33 PM |
|
|
|
|
 |
 |