Advertisement

06.03.2008 at 03:41PM PDT, ID: 23455002
[x]
Attachment Details

type Mismatch - on Query - need another pair of eyes.

Asked by kfschaefer1 in Microsoft Access Database, Access Coding/Macros

Tags: MS, Access, 2003

I am getting a type mismatch on the '>>>>>> portion of my code.  what i am trying to accomplish is to append a record based on the current record on a form to a new record.  then capture the recid for the newly created record and the goto that record.  I am having difficulty establishing the new recid.

What am I missing.

Thanks,
KStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
Private Sub cmdCopyPOH_Click()
Dim strsql, gUser, gId, gAPNo, gPOHId As String
Dim rs As Recordset
gAPNo = Me.txtApToCopyTo.Value
gPOHId = Me.intCtrPartsOnHold.Value
 
gUser = Environ$("UserName")
strsql = "INSERT INTO TA_PartsOnHold ( Ap1, DwgNo, NameEngr, BEMS, DwgBOLD, EngrPartRvwRqst, EngrgPOH_CmplDt, EFP_POH_CmplDt, DtT, SelRec )" & _
            " SELECT  " & Chr(39) & gAPNo & Chr(39) & " AS Ap1, DwgNo, NameEngr, BEMS, DwgBOLD, EngrPartRvwRqst, EngrgPOH_CmplDt, EFP_POH_CmplDt, DtT, SelRec" & _
            " FROM TA_PartsOnHold" & _
            " WHERE CtrPartsOnHold = " & gPOHId & ""
        CurrentDb.Execute (strsql)
     '>>>>>>>>   strsql = "Select max(CtrPartsOnHold) as POHID from TA_PartsOnHold where user =  'bd645c' "
    ">>>>>>>   ' strsql = "Select max(CtrPartsOnHold) as POHID from TA_PartsOnHold where user =  " & gUser & " "
        Debug.Print strsql
        Set rs = CurrentDb.OpenRecordset(strsql)
        Do Until rs.EOF
            gId = rs.Fields("POHID").Value
        Loop
       DoCmd.GoToRecord , , acGoTo, "CtrPartsOnHold = " & gId & ""
 
End Sub
 
Loading Advertisement...
 
[+][-]06.03.2008 at 03:53PM PDT, ID: 21705317

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]06.03.2008 at 03:55PM PDT, ID: 21705331

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 04:32PM PDT, ID: 21705484

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 06:00PM PDT, ID: 21705882

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Access Database, Access Coding/Macros
Tags: MS, Access, 2003
Sign Up Now!
Solution Provided By: GRayL
Participating Experts: 3
Solution Grade: A
 
 
[+][-]06.03.2008 at 08:15PM PDT, ID: 21706567

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 08:41PM PDT, ID: 21706742

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]06.04.2008 at 07:47AM PDT, ID: 21710661

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.04.2008 at 08:37AM PDT, ID: 21711168

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.04.2008 at 08:45AM PDT, ID: 21711255

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628