Complie error: ByRef arguement type mismatch

Aza_CC

New member
Local time
Today, 09:19
Joined
Nov 14, 2006
Messages
4
hello i need some help, i am getting this error when i press ok for a bill of materials. now i am not an expert on wither access or visual basic so this has got me lost. I did not make the database but am simply changing it to suit my needs. This function works fine in the original version (which i have) but i have modified the form in order for it to look abit better and now it does not work.....

it comes up with:

Complie error: ByRef arguement type mismatch

then when i press ok it brings me into visual basic and draws my attention

Private Sub btnOK_Click()

On Error Resume Next

glMajorPartNo = MajorPartNo
gbFormValue = True
glVehicleID = cboVehicleID

DoCmd.Hourglass True

If Not IsNull(cboVehicleID.VALUE) And Not cboVehicleID.VALUE = "" Then
CopyVehicleBOMToPartsReport cboVehicleID
Else
SetupReport MajorPartNo
End If

DoCmd.OpenReport ReportName, A_PREVIEW

DoCmd.Hourglass False

End Sub



I am using Access 2003 and visual basic 6.3,

any help would be good cuase i dont understand why it works in one and not in this one, as far as i know i havnt touched any or the coding
 
Access should have highlighted a line. Which one? I would suspect one in this section of the code that seems to call two Functions that are not listed in the code.
Code:
If Not IsNull(cboVehicleID.VALUE) And Not cboVehicleID.VALUE = "" Then
CopyVehicleBOMToPartsReport cboVehicleID
Else
SetupReport MajorPartNo
End If
 
Private Sub btnOK_Click()

On Error Resume Next

glMajorPartNo = MajorPartNo
gbFormValue = True
glVehicleID = cboVehicleID

DoCmd.Hourglass True

If Not IsNull(cboVehicleID.VALUE) And Not cboVehicleID.VALUE = "" Then
CopyVehicleBOMToPartsReport cboVehicleID
Else
SetupReport MajorPartNo
End If

DoCmd.OpenReport ReportName, A_PREVIEW

DoCmd.Hourglass False

End Sub
 
the problem is then that your combo box cbovehicle is of a certain datatype, and your function/sub CopyVehicleBOMToPartsReport is expecting a different data type.

might be that the combobox is returning a hidden bound column, and you need one of the other columns, in which case its

cboVehicleID.column(x)

its strange because your test above that is testing for a string in cbovehicleid - what data type is it?
 
i have no idea i didnt do the scripting or anything, either way i have over come this i found out the problem. i had deleted an un needed combo box and it couldnt find it. but yeah thats ok now. i now have a different problem though haha if u look in forms part. its annoying me the database is like finished and i am having small crappy problems now
 

Users who are viewing this thread

Back
Top Bottom