mdb=>adp - Bye bye Dlookup ;)

  • Thread starter Thread starter Andro Dgebuadze
  • Start date Start date
A

Andro Dgebuadze

Hi

I am new to ADP so my questions may sound trivial.

1. After converting MDB to ADP My Dlookup function is not working. What
should I do?

2. My combo boxes also did not show my anything, but I could fix them by
rearranging columns in the row source and always using Bound Column 1 and
then hiding first column. Before I had Count column 1; Bound 2. Is that the
way I have to modify all my combos or there is another way?

3. Should I change my Me.xxx Expressions with Me!xxx ?

4. When I refer to the subform by [xxx]![Form]![xxx] does not work. What is
an appropriate syntax?

And finally, can you suggest a nice link where I can learn SQL scripts for
SQL Server? And also details of forms modification from mdb to adp?

Any help is highly appreciated


Andro
 
Witaj Andro,
W Twoim li¶cie datowanym 21 kwietnia 2004 (11:07:22) mo¿na przeczytaæ:

AD> Hi
AD> I am new to ADP so my questions may sound trivial.

AD> 1. After converting MDB to ADP My Dlookup function is not working. What
AD> should I do?

It happened because you possibly have not permission to do
"everything" with table.
Write your own Dlookup function.

(
something like that (I possibly do error in below code, its just
"handwrite")


Public Function jDLookUp(What As String, Where As String, Optional
When As String) As Variant
On Error GoTo Err_

Dim cmd As ADODB.Command, rst As ADODB.Recordset
Dim strSQL As String

Set cmd = New ADODB.Command
Set rst = New ADODB.Recordset

What = Replace(What, "[", "")
What = Replace(What, "]", "")
Where = Replace(Where, "[", "")
Where = Replace(Where, "]", "")

If Kiedy = "" Then
strSQL = "SELECT TOP 1 [" & What & "] as result FROM [" &
Where & "]"
Else
strSQL = "SELECT TOP 1 [" & What & "] as result FROM [" &
Where & "] WHERE " & When
End If

cmd.ActiveConnection = CurrentProject.Connection
cmd.CommandText = strSQL
cmd.CommandType = adCmdText

Set rst = cmd.Execute

If rst.RecordCount <> 0 Then
rst.MoveFirst
jDLookUp = rst("result")
Else
jDLookUp = Null
End If

rst.Close
Set rst = Nothing
Set cmd = Nothing

Exit_:
Exit Function
Err_:
debug.print err.description
Resume Exit_
End Function
)

AD> 2. My combo boxes also did not show my anything, but I could fix them by
AD> rearranging columns in the row source and always using Bound Column 1 and
AD> then hiding first column. Before I had Count column 1; Bound 2. Is that the
AD> way I have to modify all my combos or there is another way?

If your combo depends on other combo or other field you should
source to something like that:
MyCombo.RowSource = "exec MyStoredProcedure @parameter1="
& value_of_nontext_parameter_1 & ",@parameter2='" &
value_of_text_parameter_2 & "'"

AD> 3. Should I change my Me.xxx Expressions with Me!xxx ?

No.

AD> 4. When I refer to the subform by [xxx]![Form]![xxx] does not work. What is
AD> an appropriate syntax?

The correct syntax to refer to the field on subform in (both) MDB and ADP
forms is:
Forms![MyFormName].Form![MySubFormName_on_MyForm]![MyFieldOnSubForm]

AD> And finally, can you suggest a nice link where I can learn SQL scripts for
AD> SQL Server? And also details of forms modification from mdb to adp?

SQlBooksOnLine

Regards
Jacek Segit
 
Back
Top