Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Visual Basic (https://www.askmehelpdesk.com/forumdisplay.php?f=469)
-   -   Datareport1.show does not work (https://www.askmehelpdesk.com/showthread.php?t=161796)

  • Dec 11, 2007, 09:12 PM
    irfan512
    datareport1.show does not work
    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.
  • Dec 14, 2007, 05:43 PM
    Gabriel
    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'
  • Jan 3, 2008, 02:27 AM
    yuffie
    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?

  • All times are GMT -7. The time now is 09:17 PM.