Ok, so continuing the VBA newbie learning curve...I have come to a new impasse. Once again, this is with unbound forms, so in an effort to not waste any of your time those of you who feel the need to debate the sanity of going unbound I kindly request that you help someone who is working with bound forms (I have questioned my sanity enough of late).
Ok, so for those who wanna take a stab at this, here is the situation:
the objApplication comes from Form_frmRemove where
Public objApplication As New clsApplication
So, here is the basDatabase:
If it helps, here are the data types defined in the tblMain:
AppID long integer
AppLName text
AppFName text
Criteria1 text (this is actually from a lookup in another table in the db)
ThirdParty text (same as the Criteria1, from a lookup)
ActionDate stored as short date, comes from =Date$()
Notes text
empID text
empName stored as text, comes from =fOSGetUser()
Thanks for the help in advance. If you need to see the rest of it, let me know.
Ok, so for those who wanna take a stab at this, here is the situation:
- I have written my first class module (pretty simple and straight forward) and made reference to it in the code behind for the form that holds the referenced objects for the data to be filled in
- I have written another module that, I hope, will connect to my tblMain, select the record that the user puts in the form (since this will be used in multimple forms, once I get this down the first time it *should* be easier).
- I have written the code behind the form.
the objApplication comes from Form_frmRemove where
Public objApplication As New clsApplication
So, here is the basDatabase:
PHP:
Option Compare Database
Option Explicit
Dim cnn As ADODB.Connection
Dim rstApplication As ADODB.Recordset
Public Function FindApplication()
Set cnn = New ADODB.Connection
Set rstApplication = New ADODB.Recordset
Set cnn = CurrentProject.Connection
Dim SQLrcd As String
SQLrcd = "SELECT * from tblMain where AppID = " & Form_frmRemove.objApplication.AppID
With rstApplication
.LockType = adLockOptimistic
.CursorType = adOpenKeyset
.ActiveConnection = cnn
.Open SQLrcd
If .EOF Then
Form_frmRemove.objApplication.AppID = 0
Else
FillAppObject
.Close
.Open "SELECT tblMain.AppID FROM tblMain WHERE AppID = " & Form_frmRemove.objApplication.AppID
.Update
End If
.Close
End With
Exit_Here:
Exit Function
Err_Handler:
MsgBox err.Description, vbCritical
Resume Next
End Function
Public Sub FillAppObject()
With rstApplication
Form_frmRemove.objApplication.AppID = !AppID
Form_frmRemove.objApplication.AppLName = !AppLName
Form_frmRemove.objApplication.AppFName = !AppFName
Form_frmRemove.objApplication.Criteria1 = !Criteria1
Form_frmRemove.objApplication.ThirdParty = !ThirdParty
Form_frmRemove.objApplication.ActionDate = !ActionDate
Form_frmRemove.objApplication.Notes = !Notes
Form_frmRemove.objApplication.empID = !empID
Form_frmRemove.objApplication.empName = !empName
End With
End Sub
Public Sub ClearRecordsetMemory()
Set rstApplication = Nothing
End Sub
AppID long integer
AppLName text
AppFName text
Criteria1 text (this is actually from a lookup in another table in the db)
ThirdParty text (same as the Criteria1, from a lookup)
ActionDate stored as short date, comes from =Date$()
Notes text
empID text
empName stored as text, comes from =fOSGetUser()
Thanks for the help in advance. If you need to see the rest of it, let me know.