Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Type MisMatch Problem Going To Database

Status
Not open for further replies.

pdddms

Programmer
Jul 3, 2004
29
0
0
US
Here is the deal. or problem if you were. I am having a combobox on my form (loads a list of names)
the program iterates through records till it finds the record that coorisponds to the name. then it will load additional data into the record to be later used in a datareport.

here is the code. i used MZ-tools, which just tells me i have a type mismatch in the click event of the form. arghhh

Public Sub REGetMinorChildInfo(name As String, loadby As String)
Dim strHeight As String
Dim strAge As String

If loadby = "Renames" Then
loadingbyname:
With rsMinorChildren
If .RecordCount = 0 Then Exit Sub
.MoveFirst
Do While Not .EOF

If !fname & " " & !lname = Combo1.Text Then

GoTo endOfSearch
Else
.MoveNext
End If
Loop
Exit Sub
endOfSearch:
strHeight = txtFt & " Ft." & txtIn & " In."
strAge = Age(txtDOB)
!hair = txtHair
!eyes = txtEyes
!Weight = txtWt
!Height = txtheight
!allergies = txtAllergies
!Age = strAge
!work = txtWork
!home = txtHome
!cell = txtCell
!carrier = txtIns
!health_id = txtPolicy
!medicalconditions = txtConditions
End With
Exit Sub
End If
End Sub



thanks!
Stew

LoL Concepts®
 
pddms,

Could you post the click event code?

Everybody body is somebodys Nutter.
 
well it doesn't look pretty as the box isn't wide enough. for one reason or another i have got past this issue. my next issue is getting the image from the database to display in the rptImage field on the report.


Code:
Private Sub cmdCreate_Click()
   'On Error GoTo cmdCreate_Click_Error

REGetMinorChildInfo Combo1.Text, "Renames"






With rtpChildID
            Set .DataSource = Nothing
                .DataMember = ""
            Set .DataSource = rsMinorChildren.DataSource
              
                
                
              With .Sections("Section1").Controls
                    
                    
                   ' .Item("txtChildAge").DataMember = ""
                    '.Item("txtChildAge").DataField = Age(txtDOB)
                    
                     
                     .Item("txtChildHeight").DataMember = ""
                    .Item("txtChildHeight").DataField = rsMinorChildren!Height.name
                   
                   .Item("txtChildWeight").DataMember = ""
                    .Item("txtChildWeight").DataField = rsMinorChildren!Weight.name
                    
                      .Item("txtCarrier").DataMember = ""
                    .Item("txtCarrier").DataField = rsMinorChildren!carrier.name
        
                      .Item("txtPolicy").DataMember = ""
                    .Item("txtPolicy").DataField = rsMinorChildren!health_id.name
                    
                      .Item("txtAllergies").DataMember = ""
                    .Item("txtAllergies").DataField = rsMinorChildren!allergies.name
                    
                      .Item("txtMedConditions").DataMember = ""
                    .Item("txtMedConditions").DataField = rsMinorChildren!medicalconditions.name
                    
                      .Item("txtCustodialParent").DataMember = ""
                    .Item("txtCustodialParent").DataField = rsMinorChildren!custody.name
                    
                      .Item("txtAddress").DataMember = ""
                    .Item("txtAddress").DataField = rsMinorChildren!address.name
                    
                     ' .Item("txtCityStZip").DataMember = ""
                    '.Item("txtCityStZip").DataField = rsMinorChildren!city & "," & rsMinorChildren!st & " " & rsMinorChildren!zip
                    
                      .Item("txtChildEyes").DataMember = ""
                    .Item("txtChildEyes").DataField = rsMinorChildren!eyes.name
                    
                    .Item("txtChildHair").DataMember = ""
                    .Item("txtChildHair").DataField = rsMinorChildren!hair.name
                    
                    .Item("txtHome").DataMember = ""
                    .Item("txtHome").DataField = rsMinorChildren!home.name
                    
                    .Item("txtCell").DataMember = ""
                    .Item("txtCell").DataField = rsMinorChildren!cell.name
                    
                    .Item("txtWork").DataMember = ""
                    .Item("txtWork").DataField = rsMinorChildren!work.name
                    
                   ' .Item("txtChildName").DataMember = ""
                    '.Item("txtChildName").DataField = rsMinorChildren!fname & " " & rsMinorChildren!lname
                    
                    .Item("Image1").Picture = ""
                    .Item("Image1").Picture = GetImage(rsMinorChildren)
                    
                    
                    
               End With
              
               .Show
       End With

  ' On Error GoTo 0
   'Exit Sub

'cmdCreate_Click_Error:

    'MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdCreate_Click of Form frmChildID"

 

End Sub

LoL Concepts®
 
My guess would be that one of the fields your updating has a data type non compatable to the data your trying to update with (as per your error message).
I can't be sure just by reading the code (as I can't see the data types), but my sugestion would be to put a break point on the 'Private Sub cmdCreate_Click()' and step through the code to see where the error occurs and go from there.
best of luck.

Everybody body is somebodys Nutter.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top