Re: Problems with SQL coding on VB command button

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi dakoris73, you could use Nz() function to handle your null values if
any.

Also i see that there are sql clauses that are not written right
Examble:
strTxtAgtID = "SELECT AgentID, Date, Software, ProbDesc, LineGroup FROM
EOSMain WHERE EOSMain.[AgentID] = 'strAgtID';"

you must change it to

strTxtAgtID = "SELECT AgentID, Date, Software, ProbDesc, LineGroup FROM
EOSMain WHERE EOSMain.[AgentID] =" & CLng(strAgtID) & ";"

if your AgentID is a long Data type

or

strTxtAgtID = "SELECT AgentID, Date, Software, ProbDesc, LineGroup FROM
EOSMain WHERE EOSMain.[AgentID] =""" & strAgtID & """;"

if your AgentID is string data type - I hope not :)

Additional for dates before passing them into your sql clauses try to
validate them as dates with the function CDate().

Make these changes and see how it works.

.


Quantcast