MadPhilly
Posts: 19
|
| Posted: 01/16/2008, 7:30 AM |
|
With reference to closed post http://forums.codecharge.com/posts.php?post_id=68004
I want to do pretty much the same thing but when I do I immediately receive a programming error after pressing 'Add'
I turned off friendly http errors and this is what's displayed:
Microsoft VBScript runtime error '800a0007'
Out of memory: 'Request.QueryString'
/ProductionEntry/Andy_Trial.asp, line 286
Line 286 is:
If NOT Button_Insert.OnClick() OR NOT InsertRow() Then
Redirect = ""
Here's my code:
Function Production_Entry_Button_Insert_OnClick(Sender) 'Production_Entry_Button_Insert_OnClick @3-B7750AD8
'DLookup @24-760DC79C
Production_Entry.CycleTime.Value = CCDLookUp("R18","KPI_CycleTest","R14" = Production_Entry.CellNo.Value AND "ASSY" = Production_Entry.ProductNo.Value AND "OpNo" = Production_Entry.Operation.Value,DBConnection1)
'End DLookup
End Function 'Close Production_Entry_Button_Insert_OnClick @3-54C34B28
Suggestions/Solutions greatly appreciated
|
 |
 |
bedollandres
Posts: 48
|
| Posted: 01/16/2008, 8:27 AM |
|
you are missing the "&" 's.... check the closed post...
_________________
bedollandres |
 |
 |
MadPhilly
Posts: 19
|
| Posted: 01/16/2008, 8:53 AM |
|
Ok thanks for pointing that out!
Now I have another error:
Microsoft VBScript runtime error '800a000d'
Type mismatch: '[string: "R14=ACI "]'
/ProductionEntry/Andy_Trial_events.asp, line 11
And the code now looks like this:
Production_Entry.CycleTime.Value = CCDLookUp("R18","KPI_CycleTest","R14=" & Production_Entry.CellNo.Value AND "ASSY=" & Production_Entry.ProductNo.Value AND "OpNo=" & Production_Entry.Operation.Value,DBConnection1)
The data type in the form for CellNo (where the mismatch is) is Text and the field in the table that it is looking up (R14) is also Text.
Any ideas?
|
 |
 |
Edd
Posts: 547
|
| Posted: 01/16/2008, 2:57 PM |
|
Please use the Database.ToSQL operator to sort your problems out on this one.
Also your "AND's" are in the wrong place.
Cheers - Edd
_________________
Accepting and instigating change are life's challenges.
http://www.syntech.com.au |
 |
 |
MadPhilly
Posts: 19
|
| Posted: 01/17/2008, 12:58 AM |
|
Edd,
Thanks for your reply, I actually had a look at the ToSQL operator but couldn't work out how to apply it to my scenario. Also, where should the "AND's" be? I simply wrote in the same manor as a SQL query.
|
 |
 |
MadPhilly
Posts: 19
|
| Posted: 01/17/2008, 3:46 AM |
|
An update!
Fields in the SQL table I am looking up are:
R14 - Text
R18 - Float
ASSY - Text
OpNo - Text
CycleID - Int
Fields from Form Production_Entry to be used in lookup:
ProductNo [listbox] - Text
CellNo [listbox] - Text
Operation [textbox] - Text
My lookup is trying to acheive the following:
R18 is a cycle time for manufacturing one of our products. I want to populate form field CycleTime with this value where the ProductNo = ASSY, Operation = OpNo and CellNo = R14.
All the data types match so why oh why am I still receiving this damned mismatch error?!?!?
|
 |
 |
MadPhilly
Posts: 19
|
| Posted: 01/18/2008, 2:14 AM |
|
Ok another update....
I've changed my code after hours of mucking about so it now looks like this:
Function Production_Entry_Button_Insert_OnClick(Sender) 'Production_Entry_Button_Insert_OnClick @3-B7750AD8
'DLookup @24-760DC79C
Dim Part
Dim Op
Dim Cell
Dim PartSelect
Dim CellSelect
Dim OpSelect
Dim SearchField
Part = Production_Entry.ProductNo.Value
Op = Production_Entry.OpNumber.Value
Cell = Production_Entry.CellNo.Value
PartSelect = CCDLookup("PartNo","KPI_Parts","PartNo=" & DBConnection1.ToSQL(Part,ccsText),DBConnection1)
CellSelect = CCDLookup("CellNo","KPI_Cells","CellNo=" & DBConnection1.ToSQL(Cell,ccsText),DBConnection1)
OpSelect = CCDLookup("OpNumber","KPI_Ops","OpNumber=" & DBConnection1.ToSQL(Op,ccsText),DBConnection1)
SearchField = CellSelect & PartSelect & OpSelect
Production_Entry.CycleTime.Value = CCDLookup("R18","KPI_CycleTest","SearchField=" & DBConnection1.ToSQL(SearchField,ccsText),DBConnection1).
SearchField in my SQL table is a concatenation of the three fields I'm looking up.
If I manually assign the values of the three variables using quotation marks it works fine, but when using the values assigned by the controls at run-time, the form completes but no value is assigned to CycleTime.
Please please put me out of my misery
|
 |
 |
MadPhilly
Posts: 19
|
| Posted: 01/18/2008, 6:39 AM |
|
OK, since I'm a little like a Pitbull when it comes to problems I just couldn't let this go and have been working on it solid since my first post.
OH JOY OF JOYS I'VE RESOLVED IT!!!
Turns out that one of my listboxes was the problem. The SQL datasource it was using had decided to add 5 lovely spaces at the end of the entry so when I used it in my search it was inaccurate! So with a nice little RTRIM later I'm all good! 
I can now rest and stop bugging you people!
|
 |
 |
|