MySQL & FindFirst

  • Thread starter Thread starter tomfindlay
  • Start date Start date
T

tomfindlay

Guest
Hello,
I hope I have posted this to the correct forum?
Anyways, I have started porting my database backend to MySQL after a spate of corruptions and speed degrading daily, I have managed to get most things functional but one thing which I can not get working is an odd thing with the FindFirst statement.
I have the following line of code...

rst2.FindFirst "AwaitingStock=True and StockIn=False and DOA=False and Model='" & Trim(Me.Model) & "'"

which works find with Access backend but with MySQL I get the error...

Run-time error '3761':
The decimal field's precision is too small to accept the numeric you attempted to add.

This is obviously not the correct error as I am not trying to add anything!
If I remove the bit about the Model, the code executes fine, also, if I remove all the =True parts and just leave the Model part everything works fine so I guess it is because I am mixing string and integer fields in the search???

Any help greatly appreciated.


Kind regards,


Tom Findlay
 
It may be that MySQL is not properly interpreting the True and False. Try this:

rst2.FindFirst "AwaitingStock = " & True & " and StockIn = " & False & " and DOA = " & False & " and Model='" & Trim(Me.Model) & "'"

If that doesn't work, figure out what MySQL uses as the actual true and false values and substitute those. Access uses -1 for True and 0 for False but that isn't universal.
 
Still no go!

Thank you for your reply Pat, it seems the issue is with True, or -1, whichever one I use it does not like, however, when I view the table, -1 values do exist in it, I'll try changing the field type from integer to something else and see how I get on, MySQL does not have a boolean data type for some reason.

Thanks again.
 

Users who are viewing this thread

Back
Top Bottom