hi everyone, I need help on an error message. I am working on an environment that Access2003 (adp) as a front end and links to SQL server as a back end.
I am creating a table, which requests users insert a value(varchar) into the table throuth an input box on a form.
Please see the code is below:
[CODE=vb]Public Sub cmdAdd_Click()
Dim cmd As ADODB.Command
Set cmd = New ADODB.Command
Dim getStrUR As String
cmd.ActiveConne ction = CurrentProject. Connection
cmd.CommandText = "INSERT INTO dbo.NoteStatEdi tRecord" & _
"(InputURNo )" & _
"VALUES(getInputNumber( ))"
cmd.Execute
End Sub[/CODE]
the function getInputNumber( ) valides user input through input box and extract valide values(8 digits numeric values) from the input box. I have test the function in immediate windows. it works fine.
the code is below:
[CODE=vb]Public Function getInputNumber( ) As String
getInputNumber = InputBox("Enter an existing URNo to populate records.", "Please enter the URNo")
If getInputNumber <> "" Then
Do While Not IsNumeric(getIn putNumber) Or Len(getInputNum ber) <> 8
getInputNumber = InputBox("URNo is 8 digits numeric value, which contains" & _
"no Letters and space. Please re-enter the URNo.", "Caution: Invalid input found")
If getInputNumber = "" Then
Exit Function
End If
Loop
Do While IsNull(DLookup( "PID", "dbo.URs", "URNo = '" & getInputNumber & "'"))
getInputNumber = InputBox("URNo is not exist!")
If getInputNumber = "" Then
Exit Function
End If
Loop
End If
End Function[/CODE]
however, I am keeping receiving error message for the function cmdAdd_Click() above said that getInputNumber is not a recognised function name. See below:
Run-time error'-2147217900 (80040e14)':
'getInputNumber ' is not a recognized function name.
Had anyone came across this issue before? Is there a solution? Thanks in advance for any suggestions. meng
I am creating a table, which requests users insert a value(varchar) into the table throuth an input box on a form.
Please see the code is below:
[CODE=vb]Public Sub cmdAdd_Click()
Dim cmd As ADODB.Command
Set cmd = New ADODB.Command
Dim getStrUR As String
cmd.ActiveConne ction = CurrentProject. Connection
cmd.CommandText = "INSERT INTO dbo.NoteStatEdi tRecord" & _
"(InputURNo )" & _
"VALUES(getInputNumber( ))"
cmd.Execute
End Sub[/CODE]
the function getInputNumber( ) valides user input through input box and extract valide values(8 digits numeric values) from the input box. I have test the function in immediate windows. it works fine.
the code is below:
[CODE=vb]Public Function getInputNumber( ) As String
getInputNumber = InputBox("Enter an existing URNo to populate records.", "Please enter the URNo")
If getInputNumber <> "" Then
Do While Not IsNumeric(getIn putNumber) Or Len(getInputNum ber) <> 8
getInputNumber = InputBox("URNo is 8 digits numeric value, which contains" & _
"no Letters and space. Please re-enter the URNo.", "Caution: Invalid input found")
If getInputNumber = "" Then
Exit Function
End If
Loop
Do While IsNull(DLookup( "PID", "dbo.URs", "URNo = '" & getInputNumber & "'"))
getInputNumber = InputBox("URNo is not exist!")
If getInputNumber = "" Then
Exit Function
End If
Loop
End If
End Function[/CODE]
however, I am keeping receiving error message for the function cmdAdd_Click() above said that getInputNumber is not a recognised function name. See below:
Run-time error'-2147217900 (80040e14)':
'getInputNumber ' is not a recognized function name.
Had anyone came across this issue before? Is there a solution? Thanks in advance for any suggestions. meng
Comment