Cant any one tell me why this does not work

peterbowles

Registered User.
Local time
Today, 09:11
Joined
Oct 11, 2002
Messages
163
This is really baffling me if anyone can make it work I will be for ever in you dept


Thanks is advance
 
The code you have behind the command button should be replaced with this:

Code:
    Dim strSQL As String, strWhere As String

    strSQL = Left(Me.txt2.RowSource, Len(Me.txt2.RowSource) - 1)

    If IsNull(Me.txt1) = False Then
        strWhere = " Student.StudentNumber = '" & Me.txt1 & "' AND"
    End If
    If IsNull(Me.txt3) = False Then
        strWhere = strWhere & " Student.PostCode = '" & Me.txt3 & "'"
    End If

    If IsNull(strWhere) = False
        strWhere = " WHERE" & strWhere
    End If

    If Right(strWhere, 4) = " AND" Then
        strWhere = Left(strWhere, Len(strWhere) - 4)
    End If
    
    strWhere = strWhere & ";"

    strSQL = strSQL & strWhere
    
    txt2.RowSource = strSQL
 
Last edited:
peterbowles said:
I will be for ever in you dept

I didn't want to post a fixed version as I have Access XP and had to convert yours.

The code works.

If you are happy with it can you be forever in my debt, rather than my department? :D
 
Re: Re: Cant any one tell me why this does not work

thankyou for your reply and sorry for posting the message twice.

But i get an error

Number 5

invalid procedure call or argument

any ideas

I do have Access XP but I though that 97 was the most common format

so if you want to send a woking version again I would be very greatfull

Thanks
 
Thanks

Thankyou very much for the example.

I have a few more questons about it .

How do you

select values from two tables
Open a form based on the results

Sorry to keep asking you but I find it much easier to learn by seeing an example

I have uploaded a new version of the database with an extra form.

I hope you can help

Thank you in advance
 

Attachments

Users who are viewing this thread

Back
Top Bottom