Hi,
I am trying to write a function and am having diffuculties with syntax and how to go about it.
When a use clicks on a textbox, i want to set a variable which is basically the name of the box. I then want to have a public function find out if that box has any text in it.
Private Sub a0845_DblClick(Cancel As Integer)
Dim a0845 As TextBox
Dim selected As String
Dim pos As Integer
selected = "a0845"
pos = 5
if_exists
End Sub
____________________________________
Public Function if_exists()
Dim exist_booking As String
If Nz(Me.[selected], "") = "" Then
MsgBox "no data"
Else
exist_booking = Me.['selected'].Value
MsgBox "There is already a booking for " & exist_booking & " Do you wish to Delete?"
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Patients"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
End Function
As you will see, I am trying to get it to discover if the box is empty by replacing the actual text box with 'selected'#
Can anyone tell me what i am doing wrong or how to go about this.
Cheers
I am trying to write a function and am having diffuculties with syntax and how to go about it.
When a use clicks on a textbox, i want to set a variable which is basically the name of the box. I then want to have a public function find out if that box has any text in it.
Private Sub a0845_DblClick(Cancel As Integer)
Dim a0845 As TextBox
Dim selected As String
Dim pos As Integer
selected = "a0845"
pos = 5
if_exists
End Sub
____________________________________
Public Function if_exists()
Dim exist_booking As String
If Nz(Me.[selected], "") = "" Then
MsgBox "no data"
Else
exist_booking = Me.['selected'].Value
MsgBox "There is already a booking for " & exist_booking & " Do you wish to Delete?"
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Patients"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
End Function
As you will see, I am trying to get it to discover if the box is empty by replacing the actual text box with 'selected'#
Can anyone tell me what i am doing wrong or how to go about this.
Cheers