By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,594 Members | 2,062 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,594 IT Pros & Developers. It's quick & easy.

Arguments are of the wrong type, are out of acceptable range, or are in conflict with

P: 4
Hi Friend
My project is a Library System.
In Project is Book Master form. If I've select Book Type from Type Master and Publication from Publication Master then this error has come:

"Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. "

but if I've put amount manually and save the record then record has been successfully saved.

For selection of Book Type and Publication I've used Combo Box (CboBookType, CboPublication)

My code in project is as follows


This is for showing Publication (in Book Master) from Publication Master

Expand|Select|Wrap|Line Numbers
  1. Private Sub CboPublication_Click()
  2.   Set rsTemp = New ADODB.Recordset
  3.   With rsTemp
  4.     .CursorLocation = adUseClient
  5.     .CursorType = adOpenKeyset
  6.     .LockType = adLockOptimistic
  7.     .Open "Select * from tblPublicationmst where Publication = '" & CboPublication.Text & "'", Cn
  8.   End With
  9.  
  10.   With RS
  11.     If .RecordCount > 0 Then
  12.       CboPublication = !Publication
  13.       TxtQuantity.SetFocus
  14.     Else
  15.       MsgBox "Invalid Publication Name", vbInformation
  16.       CboPublication.Text = "" & Publication & ""
  17.       Exit Sub
  18.     End If
  19.     .Close
  20.   End With
  21. End Sub
This is for showing Book Type (in Book Master) from Type Master

Expand|Select|Wrap|Line Numbers
  1. Private Sub CboBookType_Click()
  2.   Set rsTemp = New ADODB.Recordset
  3.   rsTemp.Open "Select * FROM tblTypemst WHERE TypeName='" & CboBookType.Text & "'", Cn, adOpenKeyset, adLockOptimistic
  4.   With rsTemp
  5.     If .RecordCount > 0 Then
  6.       CboBookType.Text = !TypeName
  7.       TxtAouthor.SetFocus
  8.     Else
  9.       MsgBox "Invalid Book Type", vbInformation
  10.       CboBookType.Text = ""
  11.       Exit Sub
  12.     End If
  13.     .Close
  14.   End With
  15. End Sub
Please Friend Help .
It's urgent.

Regards
Neel
Dec 30 '07 #1
Share this Question
Share on Google+
12 Replies


100+
P: 274
Try to see what in your selected value using message like this before

Expand|Select|Wrap|Line Numbers
  1. msgbox CboBookType.Text 
before
Expand|Select|Wrap|Line Numbers
  1. rsTemp.Open "Select * FROM tblTypemst WHERE TypeName='" & CboBookType.Text & "'", Cn, adOpenKeyset, adLockOptimistic
It will give you idea whats you are passing in the variable.
Dec 30 '07 #2

Expert 5K+
P: 8,434
Three questions...
  1. What version of VB are you using? (From the code, it looks like VB6)
  2. What line produces the error?
  3. Assuming it's one of the ones that executes an SQL query, what exact value is being substituted in there to look for? You can interrupt the code at that point (or just wait for the error to occur) then use VB's built-in debugging tools to examine or change variables and properties.
Dec 31 '07 #3

P: 4
Three questions...
  1. What version of VB are you using? (From the code, it looks like VB6)
  2. What line produces the error?
  3. Assuming it's one of the ones that executes an SQL query, what exact value is being substituted in there to look for? You can interrupt the code at that point (or just wait for the error to occur) then use VB's built-in debugging tools to examine or change variables and properties.
I'm using Vb 6.0 & Error has come on line No. - 7 & 3
Jan 2 '08 #4

QVeen72
Expert 100+
P: 1,445
Hi,

Is the Connection Object (Cn) Open...?
Where have you Declared rsTemp?
Check what is selected in the ComboBox..?
Does your Queries work @ backend...?

REgards
Veena
Jan 2 '08 #5

100+
P: 274
have you defined rsTemp ?
What is data type of publication in database?
Jan 2 '08 #6

100+
P: 274
what a coincident? Veena and I asked alomost same questions? matter of time.
Jan 2 '08 #7

P: 4
have you defined rsTemp ?
What is data type of publication in database?
Hi
I've declare rsTemp in Module
Publications is Text data type in Publicationmst
BookType is Text Data type in Bookmst
Query is not work @ backend
error has come on query line.
Jan 2 '08 #8

100+
P: 274
Have you tried looking what you have in your queries?
Please once try this by storing value of your query in a string and then see what you have in it before you open recordset.
Jan 2 '08 #9

QVeen72
Expert 100+
P: 1,445
In your first post :

Open "Select * from tblPublicationmst where Publication = '" & CboPublication.Text & "'", Cn
In this post you say...
Publications is Text data type in Publicationmst
so check the Table name :tblPublicationmst Or Publicationmst
also field name : Publication Or Publications

also you say :
Query is not work @ backend
How do you expect to work from VB6...?

REgards
Veena
Jan 2 '08 #10

Expert 5K+
P: 8,434
... How do you expect to work from VB6...?
I suspect this merely reflects confusion over what you meant by "work at backend".
Jan 3 '08 #11

QVeen72
Expert 100+
P: 1,445
Hi,

By "BackEnd" , I meant, in Backend-Database..
I was not sure of what database he was using..


Regards
Veena
Jan 4 '08 #12

P: 4
Hi,

By "BackEnd" , I meant, in Backend-Database..
I was not sure of what database he was using..


Regards
Veena
I Mean yar I'm using MS Access as a Database
( Laibrary.mdb ) is my database file

table name is - tblPublicationmst &
field name is - Publication
Jan 8 '08 #13

Post your reply

Sign in to post your reply or Sign up for a free account.