Minggu, 02 Oktober 2011

RE: [MS_AccessPros] error 13 type mismatch

 

Do this:

Private Sub Form_AfterUpdate()

On Error GoTo Err_Handler
'Purpose: Requery the combo that may have called this in its DblClick
Dim iErrCount As Integer
Const strcCallingForm = "frm_CaseRecord"

If CurrentProject.AllForms(strcCallingForm).IsLoaded Then
Forms(strcCallingForm)![CaseRecordNo].Requery

End If

Exit_Handler:
Exit Sub

Err_Handler:
'Undo the combo if it has a partially entered value.
If (Err.Number = 2118) And (iErrCount < 3) And Not (cbo Is Nothing) Then
cbo.Undo
Resume
End If
MsgBox "Error " & Err.Number & ": " & Err.Description
Resume Exit_Handler
End Sub

John Viescas, author
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)

-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of rkulez
Sent: Sunday, October 02, 2011 8:22 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] error 13 type mismatch

Dear John, excuse me please. You are right, I didn't included my previous
message. My problem was: I have a pop up form with the code below and when I run
it I get a message as: Error 13: Type mismatch. After Graham's explanation of
your reply message I run the form again and when I debug the form it showed me
"Set cbo = Forms(strcCallingForm)![CaseRecordNo]" sentence as the wrong one. I
am using access 2003. How can I fix it? Thanks again.
Ruhi Kulez

My code is:
Private Sub Form_AfterUpdate()

'On Error GoTo Err_Handler
'Purpose: Requery the combo that may have called this in its DblClick
Dim cbo As ComboBox
Dim iErrCount As Integer
Const strcCallingForm = "frm_CaseRecord"

If CurrentProject.AllForms(strcCallingForm).IsLoaded Then
Set cbo = Forms(strcCallingForm)![CaseRecordNo]
cbo.Requery

End If

Exit_Handler:
Exit Sub

Err_Handler:
'Undo the combo if it has a partially entered value.
If (Err.Number = 2118) And (iErrCount < 3) And Not (cbo Is Nothing) Then
cbo.Undo
Resume
End If
MsgBox "Error " & Err.Number & ": " & Err.Description
Resume Exit_Handler
End Sub

--- In MS_Access_Professionals@yahoogroups.com, "John Viescas" <john@...> wrote:
>
> rkulez-
>
> You didn't include the previous message screen nor all your code, so I have no
> clue what you're talking about. I handle dozens of messages a day, so I don't
> remember any previous discussion.
>
> John Viescas, author
> Microsoft Office Access 2010 Inside Out
> Microsoft Office Access 2007 Inside Out
> Building Microsoft Access Applications
> Microsoft Office Access 2003 Inside Out
> SQL Queries for Mere Mortals
> http://www.viescas.com/
> (Paris, France)
>
>
>
> -----Original Message-----
> From: MS_Access_Professionals@yahoogroups.com
> [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of rkulez
> Sent: Saturday, October 01, 2011 6:48 PM
> To: MS_Access_Professionals@yahoogroups.com
> Subject: Re: [MS_AccessPros] error 13 type mismatch
>
> John, I am not good with vb, must I write the code like?:
>
> Private Sub Form_AfterUpdate()
> 'On Error
> On Error GoTo Err_Handler
> 'Purpose: Requery the combo that may have called this in its DblClick
> Dim cbo As ComboBox
> Dim iErrCount As Integer
> Const strcCallingForm = "frm_CaseRecord"
> .......
> .........
> endsub
>
> I wrote this and tried to run it in vb window, but a form named "macros"
opens.
> In this case I tried to save and open my pop up form but again I get the type
> mismatch error. I think I need more explanation.Thanks again.
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>

------------------------------------

Yahoo! Groups Links

__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Tidak ada komentar:

Posting Komentar