Results 1 to 2 of 2

Thread: SQL Help

  1. #1
    Join Date
    Jan 2003
    Location
    Columbia, MO
    Posts
    57

    Unanswered: SQL Help

    I have a form with a subform that I am trying to get 2 fields of the subform filled with data from the user before the form will allow a new record to be entered or before the form closes. I don't know much about SQL and something is obviously wrong with this piece. When I try to run it, a message pops up saying "Object doesn't support this property or method"
    Any thoughts? Thanks.


    Private Sub NewCow_Click()
    On Error GoTo Err_NewCow_Click


    Dim stDocName As String
    Dim VarItem As Variant
    Dim rst As DAO.Recordset
    Dim strSQL As String
    Dim strCowLocation As String
    Dim strDateMovedTo As String

    Dim db As DAO.Database

    Dim tdf As DAO.TableDef
    Set db = CurrentDb()


    strDateMovedTo = " " & Me!frmsbCowLocationsEntry.DateMovedTo
    strCowLocation = " " & Me!frmsbCowLocationsEntry.CowLocation
    If Trim(strDateMovedTo) = "" Then
    MsgBox "You Must Enter A Move Date To Continue!"
    Else
    If Trim(strCowLocation) = "" Then
    MsgBox "You Must Enter A Cow Location To Continue!"

    Else

    DoCmd.GoToRecord , , acNewRec
    End If
    Exit_NewCow_Click:
    Exit Sub

    Err_NewCow_Click:
    MsgBox Err.Description
    Resume Exit_NewCow_Click
    End If
    End Sub

  2. #2
    Join Date
    Jul 2003
    Location
    Amsterdam, Nederland
    Posts
    450

    hay

    1 . Dim strSQL As String isnt used
    2 . can u stop the code with a F9 on the line Private Sub NewCow_Click()
    then walk thru the code with F8 to see where u get the err (if u cant solve it, then report back )


    3. i see the following :
    if x then
    else
    if x then
    else

    end if
    end if

    do it like this
    If x Then
    Stop
    ElseIf x Then
    Stop
    Else
    Stop
    End If

Posting Permissions

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