I have a query that runs behind a button that is acting strangely, or I am strange. The SQl is
The query runs fine on it's own, but when I put behind the button I have to enter the company name 2 times before the data appears into the output box.
When It gets to the 5th line, it askes for input. And askes again. I've moved the 5th and 6th lines around to different places in the code to see if order makes a difference, but it doesn't, and curious as to why this doesn't work. Do I need to have the data entered into a textbox and have the query reference that for the input? I am using this technique or several other queries that don't ask for input from the user, and they run fine.
Code:
SELECT Mastertbl3.ID, Mastertbl3.callingnumber, Mastertbl3.companyname1, Mastertbl3.calldate, Mastertbl3.starttime, Mastertbl3.[1stcontact], Mastertbl3.[2ndCtctClass], Mastertbl3.[3rdcontact]
FROM Mastertbl3
WHERE (((Mastertbl3.companyname1)=["Enter Company Name"]))
ORDER BY Mastertbl3.calldate;
The query runs fine on it's own, but when I put behind the button I have to enter the company name 2 times before the data appears into the output box.
Code:
Me.QryLbl.Visible = True
Me.QryResulttb.Visible = True
Me.QryResulttb.Height = 7000
Me.QryResulttb.Width = 22100
Me.QryResulttb.RowSourceType = "Table/Query"
Me.QryResulttb.RowSource = "QryCompanybyName"
Me.QryResulttb.ColumnCount = 9
Me.QryResulttb.ColumnWidths = ".4in;.7in;2in;.7in;.8in;1.0in;.8in;.6in;1.5in"
When It gets to the 5th line, it askes for input. And askes again. I've moved the 5th and 6th lines around to different places in the code to see if order makes a difference, but it doesn't, and curious as to why this doesn't work. Do I need to have the data entered into a textbox and have the query reference that for the input? I am using this technique or several other queries that don't ask for input from the user, and they run fine.
Last edited: