-
I need to get the case to be pulled up from what the user inputs in an input box and then query the database with that information. I cannot get it to work. I am using an msflexgrid so all cases will appear for the same person. people can be in the database by their case number more than once -- but each complaint has its own autonumber. If you follow. So the same case number say 000000 could be in the database 10 times and I want all of those to show up in the grid, but the "000000" needs to be a variable for the query!!
here is my code i am getting a syntax error:
Private Sub Form_Load()
GetAuto$ = InputBox("Enter Case No", "PSR Input Data")
Data2.RecordSource = "SELECT * FROM MASTER WHERE CASE_NO LIKE '" & GetAuto$ & "" ' ""
End Sub
-
Is case_no text or numeric?
Do you want to get an exact match or can the user enter a partial case_no?
-
well it would be an exact match
thanks
-
An exact match for Char text would be
Data2.RecordSource = "SELECT * FROM MASTER WHERE CASE_NO = '" & GetAuto$ & "'"
An exact match for a numeric field would be
Data2.RecordSource = "SELECT * FROM MASTER WHERE CASE_NO =" & clng(GetAuto$)
The database field CASE_NO will drive which format you use.
[Edited by JHausmann on 03-28-2000 at 07:17 PM]
-
The numeric field would have to be defined in the access database as such
because I gave it a text property in the database even though it is always numbers; what would be the benefit of changing it to numeric? How does it help -- with the integrity or are there other good reasons
Help a lamer is in the house!!!
-
Numerics
Bebe,
How are you using the data in the numeric field. If you are doing any math against the field then you would probably want it numeric. If it is a display type only field then it isn't as important (although if it is always going to be numeric I would make it numeric because it makes it easier to query against it). :P
If it was text then "0003", "003" and "3" would be different where a numeric value would be identical (3).