471,073 Members | 1,116 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,073 software developers and data experts.

Referencing Microsoft Access Forms in a .dll

Can

I have a Microsoft Access front end, SQL server backend and I am using .dll
files to complete the n-tier application. How do I reference an unbound
textbox (from Microsoft Access) in the .dll?

In the code below it does not recognize
Forms!SQL_Server_Prompt
Patient_Hospital_ID -> unbound textbox in a MS Access form
Select_Waiting_List -> unbound textbox in a MS Access form
Select_OR_Completed -> unbound textbox in a MS Access form
Select_Billing_Completed -> unbound textbox in a MS Access form

For example:

Imports System.net
Imports System.IO
Imports ADODB
Imports System.Data
Imports System.Data.OleDb
Imports CardiacSurgeryData.DataAccess

Public Class CardiacSurgeryPatients

Private Const conModuleName As String = "CardiacSurgeryPatients"

Public Function GetRstPatient_ID( _
ByVal ConnectionString As String, _
ByVal Patient_Hospital_ID As String, _
ByVal Select_Waiting_List As String, _
ByVal Select_OR_Completed As String, _
ByVal Select_Billing_Completed As String) As ADODB.Recordset
On Error GoTo Handle_Err

Const conProcName = conModuleName & ".GetRstPatient_ID"
Dim rst As ADODB.Recordset
Dim da As CardiacSurgeryData.DataAccess

' Use another middle-tier object to run a stored procedure and
return a disconnected, read-only recordset.
da = New CardiacSurgeryData.DataAccess
rst = da.GetRstFromSPwQuadrupleInputParam( _
ConnectionString:=Forms!SQL_Server_Prompt.OLEDBCon nect, _
StoredProcName:="pPatientList_ID", _
RstLockType:=ADODB.LockTypeEnum.adLockReadOnly, _
ParamDataType1:=ADODB.DataTypeEnum.adWChar, _
ParamSize1:=9, _
ParamValue1:=Me.Patient_Hospital_ID, _
ParamDataType2:=ADODB.DataTypeEnum.adWChar, _
ParamSize2:=12, _
ParamValue2:=Me.Select_Waiting_List, _
ParamDataType3:=ADODB.DataTypeEnum.adWChar, _
ParamSize3:=13, _
ParamValue3:=Me.Select_OR_Completed, _
ParamDataType4:=ADODB.DataTypeEnum.adWChar, _
ParamSize4:=16, _
ParamValue4:=Me.Select_Billing_Completed)
GetRstPatient_ID = rst
rst = Nothing
da = Nothing

Exit_Here:
Exit Function
Handle_Err:
Select Case Err.Number
Case Else
Err.Raise(Err.Number, conProcName, Err.Description,
Err.HelpFile, Err.HelpContext)
End Select
Resume Exit_Here
Resume
End Function

End Class

This may sound complicated but the theory was we had a bunch of MS Access
databases and want to convert them to SQL. We still want to use the MS
Access frontends but we want to create as much flexibility for the future, a
lot of this databases will probably become web-based.

Thanks,

Candace
Nov 21 '05 #1
2 2120
It looks to me like you just need to pass the text value of those text
boxes, not a reference to the actual textbox.

Tom

Can wrote:
I have a Microsoft Access front end, SQL server backend and I am using .dll
files to complete the n-tier application. How do I reference an unbound
textbox (from Microsoft Access) in the .dll?

In the code below it does not recognize
Forms!SQL_Server_Prompt
Patient_Hospital_ID -> unbound textbox in a MS Access form
Select_Waiting_List -> unbound textbox in a MS Access form
Select_OR_Completed -> unbound textbox in a MS Access form
Select_Billing_Completed -> unbound textbox in a MS Access form

For example:

Imports System.net
Imports System.IO
Imports ADODB
Imports System.Data
Imports System.Data.OleDb
Imports CardiacSurgeryData.DataAccess

Public Class CardiacSurgeryPatients

Private Const conModuleName As String = "CardiacSurgeryPatients"

Public Function GetRstPatient_ID( _
ByVal ConnectionString As String, _
ByVal Patient_Hospital_ID As String, _
ByVal Select_Waiting_List As String, _
ByVal Select_OR_Completed As String, _
ByVal Select_Billing_Completed As String) As ADODB.Recordset
On Error GoTo Handle_Err

Const conProcName = conModuleName & ".GetRstPatient_ID"
Dim rst As ADODB.Recordset
Dim da As CardiacSurgeryData.DataAccess

' Use another middle-tier object to run a stored procedure and
return a disconnected, read-only recordset.
da = New CardiacSurgeryData.DataAccess
rst = da.GetRstFromSPwQuadrupleInputParam( _
ConnectionString:=Forms!SQL_Server_Prompt.OLEDBCon nect, _
StoredProcName:="pPatientList_ID", _
RstLockType:=ADODB.LockTypeEnum.adLockReadOnly, _
ParamDataType1:=ADODB.DataTypeEnum.adWChar, _
ParamSize1:=9, _
ParamValue1:=Me.Patient_Hospital_ID, _
ParamDataType2:=ADODB.DataTypeEnum.adWChar, _
ParamSize2:=12, _
ParamValue2:=Me.Select_Waiting_List, _
ParamDataType3:=ADODB.DataTypeEnum.adWChar, _
ParamSize3:=13, _
ParamValue3:=Me.Select_OR_Completed, _
ParamDataType4:=ADODB.DataTypeEnum.adWChar, _
ParamSize4:=16, _
ParamValue4:=Me.Select_Billing_Completed)
GetRstPatient_ID = rst
rst = Nothing
da = Nothing

Exit_Here:
Exit Function
Handle_Err:
Select Case Err.Number
Case Else
Err.Raise(Err.Number, conProcName, Err.Description,
Err.HelpFile, Err.HelpContext)
End Select
Resume Exit_Here
Resume
End Function

End Class

This may sound complicated but the theory was we had a bunch of MS Access
databases and want to convert them to SQL. We still want to use the MS
Access frontends but we want to create as much flexibility for the future, a
lot of this databases will probably become web-based.

Thanks,

Candace

Nov 21 '05 #2
Can

Thanks. How do I pass the text value of those text boxes?
"tomb" wrote:
It looks to me like you just need to pass the text value of those text
boxes, not a reference to the actual textbox.

Tom

Can wrote:
I have a Microsoft Access front end, SQL server backend and I am using .dll
files to complete the n-tier application. How do I reference an unbound
textbox (from Microsoft Access) in the .dll?

In the code below it does not recognize
Forms!SQL_Server_Prompt
Patient_Hospital_ID -> unbound textbox in a MS Access form
Select_Waiting_List -> unbound textbox in a MS Access form
Select_OR_Completed -> unbound textbox in a MS Access form
Select_Billing_Completed -> unbound textbox in a MS Access form

For example:

Imports System.net
Imports System.IO
Imports ADODB
Imports System.Data
Imports System.Data.OleDb
Imports CardiacSurgeryData.DataAccess

Public Class CardiacSurgeryPatients

Private Const conModuleName As String = "CardiacSurgeryPatients"

Public Function GetRstPatient_ID( _
ByVal ConnectionString As String, _
ByVal Patient_Hospital_ID As String, _
ByVal Select_Waiting_List As String, _
ByVal Select_OR_Completed As String, _
ByVal Select_Billing_Completed As String) As ADODB.Recordset
On Error GoTo Handle_Err

Const conProcName = conModuleName & ".GetRstPatient_ID"
Dim rst As ADODB.Recordset
Dim da As CardiacSurgeryData.DataAccess

' Use another middle-tier object to run a stored procedure and
return a disconnected, read-only recordset.
da = New CardiacSurgeryData.DataAccess
rst = da.GetRstFromSPwQuadrupleInputParam( _
ConnectionString:=Forms!SQL_Server_Prompt.OLEDBCon nect, _
StoredProcName:="pPatientList_ID", _
RstLockType:=ADODB.LockTypeEnum.adLockReadOnly, _
ParamDataType1:=ADODB.DataTypeEnum.adWChar, _
ParamSize1:=9, _
ParamValue1:=Me.Patient_Hospital_ID, _
ParamDataType2:=ADODB.DataTypeEnum.adWChar, _
ParamSize2:=12, _
ParamValue2:=Me.Select_Waiting_List, _
ParamDataType3:=ADODB.DataTypeEnum.adWChar, _
ParamSize3:=13, _
ParamValue3:=Me.Select_OR_Completed, _
ParamDataType4:=ADODB.DataTypeEnum.adWChar, _
ParamSize4:=16, _
ParamValue4:=Me.Select_Billing_Completed)
GetRstPatient_ID = rst
rst = Nothing
da = Nothing

Exit_Here:
Exit Function
Handle_Err:
Select Case Err.Number
Case Else
Err.Raise(Err.Number, conProcName, Err.Description,
Err.HelpFile, Err.HelpContext)
End Select
Resume Exit_Here
Resume
End Function

End Class

This may sound complicated but the theory was we had a bunch of MS Access
databases and want to convert them to SQL. We still want to use the MS
Access frontends but we want to create as much flexibility for the future, a
lot of this databases will probably become web-based.

Thanks,

Candace

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Tony Williams | last post: by
2 posts views Thread by William Wisnieski | last post: by
12 posts views Thread by Mark Broadbent | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.