Form/Subform/Command Button to Open Form - Type Mismatch Error

I have a table (1), one subform (2) and another "subform" (3), which is a 
form being opened by a command button on the subform (2).  I have been 
agonizing over this for at least a week and cannot for the life of me figure 
out what is wrong.  (However, in my journey I have learned how to debug and 
use the immediate window!)  

The last straw was when I fixed one problem only to have a Type Mismatch 
error!  Below is the code for the command button on the subform (2):

Private Sub cmdbtnProgressNotes_Click()
On Error GoTo Err_cmdbtnProgressNotes_Click

    Dim strLinkCriteria As String
    Dim strDocName As String
   
    strDocName = "subfrmToDoProgressNotes"
        ' If ToDoInstructionsID control is blank, display a message.
    If IsNull(Me![ToDoInstructionsID]) Then
        Me![ToDoInstructionsID].SetFocus
    Else
    ' Otherwise, open Product List form, showing products for current 
supplier.
        strDocName = "subfrmToDoProgressNotes"
        strLinkCriteria = "ToDoInstructionsID = 
Forms!frmToDo!subfrmToDoInstructions!ToDoInstructionsID"
        DoCmd.OpenForm strDocName, acFormAdd, , , strLinkCriteria
    End If
  
Exit_cmdbtnProgressNotes_Click:
    Exit Sub

Err_cmdbtnProgressNotes_Click:
    MsgBox Err.Description
    Resume Exit_cmdbtnProgressNotes_Click
    
End Sub



and this is the code on Current for the subform (2):

Private Sub Form_Current()

' This code created by Form Wizard.
    Dim strParentDocName As String

    On Error Resume Next
    strParentDocName = Me.Parent.Name

    If Err <> 0 Then
        GoTo Form_Current_Exit
    Else
        On Error GoTo Form_Current_Err
        Me.Parent![subfrmProgressNotes].Requery
    End If

Form_Current_Exit:
    Exit Sub

Form_Current_Err:
    MsgBox Err.Description
    Resume Form_Current_Exit

End Sub

Can somebody please tell where I have gone wrong?  Thanks.
-- 
S
0
Utf
7/12/2007 8:22:02 PM
access.formscoding 7493 articles. 0 followers. Follow

2 Replies
1187 Views

Similar Articles

[PageSpeed] 31

Change the strLinkCriteria line to this:
strLinkCriteria = "ToDoInstructionsID = " & 
Forms!frmToDo!subfrmToDoInstructions!ToDoInstructionsID

Steve

"Sharon" wrote:

> I have a table (1), one subform (2) and another "subform" (3), which is a 
> form being opened by a command button on the subform (2).  I have been 
> agonizing over this for at least a week and cannot for the life of me figure 
> out what is wrong.  (However, in my journey I have learned how to debug and 
> use the immediate window!)  
> 
> The last straw was when I fixed one problem only to have a Type Mismatch 
> error!  Below is the code for the command button on the subform (2):
> 
> Private Sub cmdbtnProgressNotes_Click()
> On Error GoTo Err_cmdbtnProgressNotes_Click
> 
>     Dim strLinkCriteria As String
>     Dim strDocName As String
>    
>     strDocName = "subfrmToDoProgressNotes"
>         ' If ToDoInstructionsID control is blank, display a message.
>     If IsNull(Me![ToDoInstructionsID]) Then
>         Me![ToDoInstructionsID].SetFocus
>     Else
>     ' Otherwise, open Product List form, showing products for current 
> supplier.
>         strDocName = "subfrmToDoProgressNotes"
>         strLinkCriteria = "ToDoInstructionsID = 
> Forms!frmToDo!subfrmToDoInstructions!ToDoInstructionsID"
>         DoCmd.OpenForm strDocName, acFormAdd, , , strLinkCriteria
>     End If
>   
> Exit_cmdbtnProgressNotes_Click:
>     Exit Sub
> 
> Err_cmdbtnProgressNotes_Click:
>     MsgBox Err.Description
>     Resume Exit_cmdbtnProgressNotes_Click
>     
> End Sub
> 
> 
> 
> and this is the code on Current for the subform (2):
> 
> Private Sub Form_Current()
> 
> ' This code created by Form Wizard.
>     Dim strParentDocName As String
> 
>     On Error Resume Next
>     strParentDocName = Me.Parent.Name
> 
>     If Err <> 0 Then
>         GoTo Form_Current_Exit
>     Else
>         On Error GoTo Form_Current_Err
>         Me.Parent![subfrmProgressNotes].Requery
>     End If
> 
> Form_Current_Exit:
>     Exit Sub
> 
> Form_Current_Err:
>     MsgBox Err.Description
>     Resume Form_Current_Exit
> 
> End Sub
> 
> Can somebody please tell where I have gone wrong?  Thanks.
> -- 
> S
0
Utf
7/12/2007 8:32:05 PM
Bless you!!!
-- 
S


"SteveM" wrote:

> Change the strLinkCriteria line to this:
> strLinkCriteria = "ToDoInstructionsID = " & 
> Forms!frmToDo!subfrmToDoInstructions!ToDoInstructionsID
> 
> Steve
> 
> "Sharon" wrote:
> 
> > I have a table (1), one subform (2) and another "subform" (3), which is a 
> > form being opened by a command button on the subform (2).  I have been 
> > agonizing over this for at least a week and cannot for the life of me figure 
> > out what is wrong.  (However, in my journey I have learned how to debug and 
> > use the immediate window!)  
> > 
> > The last straw was when I fixed one problem only to have a Type Mismatch 
> > error!  Below is the code for the command button on the subform (2):
> > 
> > Private Sub cmdbtnProgressNotes_Click()
> > On Error GoTo Err_cmdbtnProgressNotes_Click
> > 
> >     Dim strLinkCriteria As String
> >     Dim strDocName As String
> >    
> >     strDocName = "subfrmToDoProgressNotes"
> >         ' If ToDoInstructionsID control is blank, display a message.
> >     If IsNull(Me![ToDoInstructionsID]) Then
> >         Me![ToDoInstructionsID].SetFocus
> >     Else
> >     ' Otherwise, open Product List form, showing products for current 
> > supplier.
> >         strDocName = "subfrmToDoProgressNotes"
> >         strLinkCriteria = "ToDoInstructionsID = 
> > Forms!frmToDo!subfrmToDoInstructions!ToDoInstructionsID"
> >         DoCmd.OpenForm strDocName, acFormAdd, , , strLinkCriteria
> >     End If
> >   
> > Exit_cmdbtnProgressNotes_Click:
> >     Exit Sub
> > 
> > Err_cmdbtnProgressNotes_Click:
> >     MsgBox Err.Description
> >     Resume Exit_cmdbtnProgressNotes_Click
> >     
> > End Sub
> > 
> > 
> > 
> > and this is the code on Current for the subform (2):
> > 
> > Private Sub Form_Current()
> > 
> > ' This code created by Form Wizard.
> >     Dim strParentDocName As String
> > 
> >     On Error Resume Next
> >     strParentDocName = Me.Parent.Name
> > 
> >     If Err <> 0 Then
> >         GoTo Form_Current_Exit
> >     Else
> >         On Error GoTo Form_Current_Err
> >         Me.Parent![subfrmProgressNotes].Requery
> >     End If
> > 
> > Form_Current_Exit:
> >     Exit Sub
> > 
> > Form_Current_Err:
> >     MsgBox Err.Description
> >     Resume Form_Current_Exit
> > 
> > End Sub
> > 
> > Can somebody please tell where I have gone wrong?  Thanks.
> > -- 
> > S
0
Utf
7/12/2007 9:02:02 PM
Reply:

Similar Artilces:

Reservation Form
I have an active website for my business. I built it in Frontpage 2002. It no longer will send email through the settings I used ( Reservation form) and I cannot get it to take any of the settings I give it. I do not think that my knowledge is sufisticated enough. And, I don't think that I am entering the information completely enough. I am using a simple form with a single enter button. Can you help? May be possible. -- ~~~~~~~~~~~~~~~~~~ Rob Giordano Microsoft MVP Expression Web "FrontPage 2002 on windows XP" <FrontPage200...

Auto populate a form form an open form
Hi I have a main form with customer names and addresses and would like to add a control button on this form which opens up another form which is used for recording telephone calls on. What I have been trying to do is auto populate this call log form with information from the main form ie name and address? Any thoughts Thanks Chris Chris, Please don't re-post the same question twice. You have to be patient and wait for a reply. Responders are volunteers, and you may not get an answer right away. Posting twice causes some people to respond to the first post, while others are ...

form pozition on screen
I would like to find form position on screen. It's similar to DoCmd.movesize, but I want discover "parameters' for form position (left corner, top corner, etc) Are you saying that you want to find out what the current position IS? If so, you can use something like this: MyFormLeftVariable = Me.Left MyFormTopVariable = Me.Top MsgBox "My Form is at " & MyFormLeftVariable & VbCrLf & MyFormTopVariable Or however you want to use it. -- Bob Larson Access World Forums Super Moderator Utter Access VIP Tutorials at http://www.btabdevelopment.com ___________...

copy properties Under forms
Hi, I'm wondering if someone can help me with something on copying properties. I've checked the access help but can't find anything there. This is what i want to do. I'm copying text boxes, labels that has caption, name and other information in the properties that i want to keep when i copy the information to another tab on a form. Is there a way i can copy the property information without doing alot of manual work by going into each text or label box. I hope this makes sense. thanks for you help in advance. Keith When you copy a control, everything about the cop...

What is the purpose of 'Dummy' window in the Command forms
I am wondering why GP has Dummy window with title "~internal~" for the Command forms. For example Command_Financial form has Dummy window Do I need to create Dummy window for my Command forms. If so why I need it. Any comments appreciated!!! Hi Mandeep, The Dummy window is there as a placeholder. It really doesn't do anything, but should be there in order for the form to work properly since your form needs to be open for the commands to be available. The title ~internal~ just prevents this window from showing up in the Security assignment windows. Make sure that...

Cannot open the Insert object (Pdf file) form Excel 2000(9.0.8968 SP-3)
Dear All, I am no idea why I cannot open the embedded object (Pdf file) inside Excel file which using Windows ME. Once clicked the object icons, then it shows the error message likes " the embedded object cannot be opened by the source application" I used the Adobe reader 6.01 as the source application. Actually, I searched the related forum from the Internet. However, I cannot solve the problem. Anyone helps? Thanks tlee Hi, I can't test 2000 in ME, but it works fine in 2003 under XP. -- If this helps, please click the Yes button. Cheers, Shane Devenshire &q...

error with SMTP and POP3
hi. mail server exchange 2003 enterprise, windows server 2003 enterprise. i see the error in pop3 and smtp when sending mail from cmd. in cmd i type 10.0.0.3 25 and enter the there. SMTP error says: 500 5.3.3 Unrecognized command i try to access SMTP locally, in my network. and the same arror prosses with POP3. It says: -ERR Protocol error i have no firewall. i use exchange in local network. to access SMTP locally, you use the telnet command, then type in the SMTP commands telnet 10.0.0.3 25 HELO localhost MAIL FROM:<test@test.com> RCPT TO:<test@test.com> DATA Su...

Form class module for non-existent form
Hi, After copying a form with a class module, something went wrong. I now have a class module for the new form, but the form no longer exists. I am unable to remove the in-limbo class module. I want to use that name for my form, which is not possible as long as that class module is in the way. How do I get rid of the in-limbo class module? I've tried repairing tha DB as well as "msaccess /decompile" but it hasn't helped. Anything else? Thanks, Kjell Kjell, A class module is not part of a form, but a separate module. It sounds like your 'in-limbo' module is...

SDK Q: "taxes distribution(s) does not equal the actual amount" error when posting
I am trying to have our orders processing system properly populate the Great Plains tables so we can TRANSFER our orders to invoices (at which point third-party tools perform so WBS re-distribution) and then POST them to GL. Thanks to rrs1977@gmail.com for your previous help. With that, I've been able to get the system to create orders and batches which Dynamics allows our users to open and Transfer to invoice (and properly triggering our third-party redistribution utilities). However, when they try to post the invoices to GL, an error shows up indicating "taxes distribution(s...

visual basic has stopped working error message
I hope this is the discussion group for VB6. I have a vb6 project with crystal report 8.5. In the program once i click on RDC to open a report in design view I got this "Visual basic has stopped working" message comes up and I have to closed out visual basic. It always happens when I tried to open the report designer. I can run or compile the program fine without opening reports. My computer is vista home with SP2. Any suggestions? "Mary" <Mary@discussions.microsoft.com> wrote in message news:C7F6B7C3-A847-43EF-A1C5-B300428EDC68@microsoft.com.....

Setting the Windows Cursor during Form Processing
hiya gurus I would like to force the mouse cursor to immediately become an hourglass when some long processing/quering commences on a form. it appears that it takes some time for Access to show the hourglass and usually only after the user clicks the form a couple of times because there appears to be nothing happening... Is there an easy way to do this from within Access.. I have done it in VB6 using Me.MousePointer = vbHourglass but this does nto work in Access.. any suggestions? cheers Jeff mmmmm Screen.MousePointer = 11 guess this does it? "jeff" <jeff@work...

opening csv file in regular excel format
i am using office 2003. i used to download csv files and open in regular excel formats...due to some problem i reinstalled windows xp and office 2003...now my csv files open with all values separated by commas and not as before... sould anyone highlight how to download csv files automatically in excel formats withouts commas? suresh babu,chennai,india -- sureshbabussb If the data has commas between each field and you want each field in a separate column, you'll have to make sure that your windows list separator is a comma. (Many places, this list separator is a semicolon.) windows...

Journal entry has already been posted error
I have a client that uses Wennsoft and Great Plains. When they go to Transactions > Job Cost > Job Transaction Entry and click on the magnifying glass next to journal entry number, they can see a list of journal entries that should have been posted. If they click on one to try to bring it to the sreen they receive a message "Journal entry XXX has already been posted." They can see where it posted on the financial side, but not against the job. Can anyone tell me what is going on and how I can fix this? Thanks, Jocelyn ...

Position 2nd Form according to 1st Form
I have 2 Forms. When the 1st Form is openned and want I open the 2nd Form, I want it to position itself about 15cm form the Left and 20cm from the top of the 1st Form. I am using Access 2003, Thanks. "AY" <AY@discussions.microsoft.com> wrote in message news:CFA3A4B5-36D9-4A20-AB57-601290155335@microsoft.com... >I have 2 Forms. When the 1st Form is openned and want I open the 2nd Form, >I > want it to position itself about 15cm form the Left and 20cm from the top > of > the 1st Form. I am using Access 2003, Thanks. You should be able to use Nicole Calinoiu...

Error -18499
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Email Client: Exchange I have setup Entourage 2008 with my work Exchange Server 2003 through WebDAV. I can receive emails and see all my public folders, however when I attempt to send an email I get: HTTP error. The server does not support this request. Mail could not be sent. The message has been moved to your Drafts folder. Error: 18499. <br><br>Any advice would be appreciated, <br> lightsquared ...

TOURNAMENT FORMS
Need tournament draw sheet single elimination template. You may find some old NCAA basketball tournament forms out on the web. Try http://google.com HHSTENNIS wrote: > > Need tournament draw sheet single elimination template. -- Dave Peterson ec35720@msn.com ...

Modal form opens on startup
Evenin' - I hope this doesn't come across as stupid, but I'm almost completely unfamiliar with Access. A client of mine has an Access 2000 database containing some business information, and he'd like to have me import it into Quickbooks. The problem I have is that I cannot get to the information to export it from Access. When the file is opened, I get a (I presume) modal form, configured as a 'splash screen' type of thing. Has my client's logo, and the name of the fellow who wrote the Access app. Click that, and it closes, then opens another form for...

Forms and Input Data
I created a report form on Sheet 1 and a set of input data on subsequen Sheets 2, 3, ... link to the report. The report is to show informatio on either of the data I select. Are there simple steps for me to pick either set of data I want t display on the report? I've thought of a pull-down menu so that if select "1", the report will show data set "1", and so on. Yet I don' know how to do it. I tried the "replace" command by highlighting al the cell in the Report sheet then type "2" in place of "1" to replac the data set then hitting...

how do i find and open a template i developed?
...

Run Macro only if certain form is open
I have programed a maco to open one of various forms depending on criteria on an open form. Is there a way to run a "follow up Macro" based on which form opens? In other words can I run a macro based on wheather a certain form is active? -- Thanks, Chuck Take a look at the RunMacro Method of the DoCmd object. You can have it as part of the OnLoad of the form in question. Chuck wrote: >I have programed a maco to open one of various forms depending on criteria on >an open form. Is there a way to run a "follow up Macro" based on which form >opens? In other w...

"Operation must use an updateable query" error in IM
Our Client is running GP10 SP1 with all users connecting through Terminal Server to Sql 2005. Receiving error "Operation must use an updateable query" when trying to run an AP Transaction integration that has worked fine until this week. The source files are *txt files and they are not using any Sql scripting in the integration. I get that whenever I have an Access database that has somehow been marked read only or if the user I am logged in as only has read permissions. Since IM uses an Access database internally, I would suggest checking that the user who's logged i...

Trying to delete form border, and it deletes all borders
I made a form with several individual areas that have borders. At the end I decided to try a border around the whole form. Now that I don't like it, I was trying to delete the form border, but it deletes all the borders in the form as well. How can I just delete the border around the form and not the rest of the individual borders? I'm actually on a different computer, because of the printing, will I be able to undo my way out of it maybe, or do I have to be on the computer where I made the form. One more question, will the form retain the undo feature for ever, or will it stop ...

can not open excel file, too many different cell formats
can not open a specific excel file, too many different cell formats message appears on my screen. the file contians about 85 work sheets Some info: XL: Error Message: Too Many Different Cell Formats http://support.microsoft.com/default.aspx?scid=213904 A few people have posted that they could open the file in OpenOffice, then remove some of the formatting, save it and then excel would open that file ok. http://www.openoffice.org, a 60-65 meg download or a CD Abdur wrote: > > can not open a specific excel file, too many different cell formats message > appears on my screen. the ...

emails lost with compression error. Restore question.
I run Vista Home Premium and have Windows Home and Student. I use Windows mail. During a mail compression I got an error saying that the program was in use and an error had occurred. All of the e-mails were lost but there was some kind of automatic e-mail restoration. I was able to retreive what I needed from a restore e-mail folder. My question -- There are now a bunch of files in my trash bin relating to the restored e-mails. They showed up there by themselves. When I click on them they are listed as restored Windows Mail files and Recovered File Fragments. Since I have...

eConnect UOFM error
hi, I have written a code for PO Enter match Invoice in eConnect.But I have received the following error message. Sql procedure error codes returned: Error Number = 4858 Stored Procedure taPopEnterMatchInvLine Error Description = UOFM is not valid for the item Node Identifier Parameters: taPopEnterMatchInvLine POPRCTNM = RCT1310 RCPTLNNM = 16384 PONUMBER = PO1105 POLNENUM = 16384 Related Error Code Parameters for Node : taPopEnterMatchInvLine ITEMNMBR = 1-A3261A UOFM = Each <taPopEnterMatchInvLine><POPRCTNM>RCT13...