Log in

View Full Version : Datareport1.show does not work


irfan512
Dec 11, 2007, 09:12 PM
Dear Sir,

I have used following vb code for displaying particular staffno on screen but it does not work.

table = elect

vb code:

private sub command1_click()

dim stsql as string

stsql = "select * from elect where staffno=" & text1.text
data1.Recordsource = stsql
data1.refresh

datareport1.show

It is not working, please guide me with compelete codes.
Thanking you.

Gabriel
Dec 14, 2007, 05:43 PM
It might help if you gave the error you are receiving.

If the 666 is a string, you may need to use single quotes so the string ends up looking like:

select * from elect where staffno='666'

yuffie
Jan 3, 2008, 02:27 AM
maybe u could change the query to

stsql = "select * from elect where staffno = ' " & text1.text & " ' "

if the staffno data type is varchar

what is data1 and datareport1?