thanks sync_or_swim, the txtDBPath textbox doesn't get my path until it my form has finished loading.
Is there a way to fix this. Here is my code
On control:
Public strPath As String
Public strConnectSQL As String
Private mstrFormula As String
'Public Property Let Formula(ByVal NewValue As String)
' mstrFormula = NewValue
' PropertyChanged "Formula"
'End Property
'Public Property Get Formula() As String
'Formula = frmbuilder.txtSQL
'End Property
Public Function Build(strPath As String, strConnectSQL) As String
frmbuilder.txtDBPath = strPath
frmbuilder.txtSQL.Text = strConnectSQL
frmbuilder.Show vbModal
If frmbuilder.okclicked = True Then
frmbuilder.okclicked = False
Build = frmbuilder.txtMyFormula
Unload frmbuilder
Else
Build = "Cancelled"
End If
End Function
Form in control Project (frmbuilder):
Public okclicked As Boolean
Private Sub CancelButton_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim db As Database
'MsgBox txtDBPath.Text
Set db = OpenDatabase(txtDBPath.Text)
'I will hide these textboxes when control is working properly
'txtDBPath.Visible = False
'txtSQL.Visible = False
txtMyFormula.Text = ""
'Set rstrecordset = db.OpenRecordset("SELECT * FROM [C4INjust a test]")
MsgBox txtDBPath.Text
TreeView1.Nodes.Add , , "INPUTS", "Inputs"
End Sub
Private Sub OKButton_Click()
okclicked = True
Formula = frmbuilder.txtSQL
Me.Hide
End Sub
standard project
added control to my form, calling like this
Private Sub Command2_Click()
MsgBox Builder1.Build(App.Path & "\products.mdb", "SELECT * FROM tbltest")
End Sub
Enter your message below
Sign in or Join us (it's free).