Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Help me about VBA

Author  Topic 

cuongmyh
Starting Member

1 Post

Posted - 2008-10-14 : 03:25:32
Hi all!
i already maked a code to connect database by using DAO.
<b>
Dim db As Database
Dim rs As Recordset
Dim str As String
Set db = CurrentDb
str = "SELECT ID,CSTCODE,PDCODE ,PALLETNUM FROM PALLET_DE WHERE ((PALLET_DE.STATUS)='" & Trim([Forms]![INPUT RETURN PALLET]![STATUS]) & "') and (((PALLET_DE.PALLETNUM)='" & Trim([Forms]![INPUT RETURN PALLET]![PALLETNUM]) & "'))"
Set rs = db.OpenRecordset(str, dbOpenDynaset, dbSeeChanges)
With rs
ID = !ID
CSTCODE = !CSTCODE
PDCODE = !PDCODE
End With
rs.Close
</b>
but i receive null value from recordset
Please help me!



Huy Cuong

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2008-10-14 : 17:47:39
Add rs.MoveFirst to your code, before the "With" statement.

Also, double-check your STR variable to ensure that it contains the SQL you expect.

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page
   

- Advertisement -