Results 1 to 5 of 5

Thread: SQL help...

  1. #1
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397

    Unanswered: SQL help...

    Sorry, I did not see my thread today morning I posted for which I had received one reply also.. Considering it is missed in the forum I am again posting my question.

    New bee to SQL server.

    I am trying to call data on form from SQL Server table. I created 3 text boxes name text0, text9 and text11. (SQL Server Desktop Ver as BE and Access as FE environment)

    I placed a cmd button and wrote following code to get it connected to server table and bring the desired record set.

    Private Sub Command2_Click()
    Dim conn As New ADODB.Connection
    Dim Rec1 As New ADODB.Recordset

    Set conn = New ADODB.Connection
    conn.CursorLocation = adUseClient
    conn.Provider = "Microsoft Sql OlEDB 4.0"
    conn.ConnectionString = " Provider=MSDASQL.1;Persist Security Info=False;Data Source=GCF;Initial Catalog=PaperRollBE"
    conn.Open conn

    Set Rec1 = New ADODB.Recordset
    Rec1.CursorLocation = adUseClient
    Rec1.CursorType = adOpenDynamic
    Rec1.LockType = adLockOptimistic
    Rec1.ActiveConnection = conn

    Rec1.Open "Select T_RollMaster.RolNo, T_RollMaster.Rollsize, T_RollMaster.GSM " & _
    "from T_RollMaster Where RolNo = " & Forms!Form1!Text0
    Me.Text9 = Rec1.Fields("Rollsize")
    Me.Text11 = Rec1.Fields("gsm")
    Rec1.Close
    Set Rec1 = Nothing
    End sub

    I am entering RolNo (Text datatype) in text0 and clicking the above button but it produced the following error. (This error is after modificaton based on the reply I had received to my missed thread).

    Run-Time error:
    [Microsoft][Microsoft SQL Server Driver][SQL Server] Invalid Column name 'FLD28430'

    FLD28430 is the rolno I am entering in the text box (Text0).

    Can someone put light over it please where the code is wrong.I attaced jpg for your ready ref.

    I know the method of ODBC but I dont want ODBC method. I need to know ADODB style.

    With kind regards,
    Ashfaque
    Attached Thumbnails Attached Thumbnails Error.JPG  

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi

    Sorry - that is my fault. I moved the thread and forgot to leave a redirect. I PMed you but obviously you didn't get it.

    I moved the thread here since it is really an Access problem (reading a value from a form and formulating a SQL string):
    http://www.dbforums.com/showthread.php?t=1612590

    I have responded & I think I have solved your problem.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397
    Thanks Pootle,

    Fantastic !!!!

    Appricated..

    With kind regards,
    Ashfaque

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    A bit of bubble gum and bailing wire, and voila! Now there's a redirect for the original thread.

    -PatP

  5. #5
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by Pat Phelan
    A bit of bubble gum and bailing wire, and voila! Now there's a redirect for the original thread.

    -PatP
    Show off
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •