Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2002
    Location
    Washington D.C.
    Posts
    164

    Unanswered: Parameter Queries in Access Projects

    Hi, I am migrating an Access db to SQL Server.
    I have a problem with my parameter queries.
    In my access db, I have a lot of parameter quereis which I pass the parameters from forms, for example:

    SELECT ... FROM... WHERE PID=[Forms]![frmPersonContact]![PersonID]

    How can we do this in Access projects for views or stored procedure or user defined functions?


    Thanks

  2. #2
    Join Date
    May 2002
    Location
    Atlanta, GA
    Posts
    117
    Hey Sia,
    I use Visual Basic in my forms for that very reason. Whether it be List Box, Combo Box, or Form Record Source just try the following.

    Private Sub Forms_Load()
    Dim mySQL As String
    mySQL = "SELECT Name FROM Table WHERE(Name = " & "'" & Forms!myForm!myField & "'" & ")"
    Me.ListBox.RowSource = mySQL
    End Sub

    If you need further help just let me know.

    Later, Kal

  3. #3
    Join Date
    Dec 2002
    Location
    Washington D.C.
    Posts
    164
    Thanks,
    thats what I was looking for.


    Originally posted by kpalmer
    Hey Sia,
    I use Visual Basic in my forms for that very reason. Whether it be List Box, Combo Box, or Form Record Source just try the following.

    Private Sub Forms_Load()
    Dim mySQL As String
    mySQL = "SELECT Name FROM Table WHERE(Name = " & "'" & Forms!myForm!myField & "'" & ")"
    Me.ListBox.RowSource = mySQL
    End Sub

    If you need further help just let me know.

    Later, Kal

  4. #4
    Join Date
    May 2002
    Location
    Atlanta, GA
    Posts
    117
    Sia,
    One other thing, make sure you get some good documentation of the differences between Access SQL and SQL Server. One of the first problems I ran into was figuring out how to make some of my advanced queries work properly.

    Later, Kal

Posting Permissions

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