Link to home
Create AccountLog in
Avatar of developingprogrammer
developingprogrammer

asked on

recordsetclone problem

guys, i'm having problems with the recordsetclone line. could yall help me out? thanks!! = ))
Private Function Model_CreateGenericFormInstance()
    
    DoCmd.OpenForm "GenericForm_Instance1", View:=acViewDesign
    
    Dim strGenericFormName As String
    strGenericFormName = "GenericForm_Instance1"
    Dim frmGeneric As Form
    Set frmGeneric = Forms(strGenericFormName)
    
    Dim strSQL As String
    Dim rsGenericForm As DAO.Recordset
    Select Case intAutomationID_obj
        Case 2
            'choose INFO data
            strSQL = "SELECT dataAWF.ATMLocation, dataAWF.TransactionDate, dataAWF.Amount, dataAWF.CreditDebit, dataAWF.RSURemarks, dataAWF.RSUAdditionalInfo FROM dataAWF WHERE (((dataAWF.RSURemarks) Is Null));"
            
            frmGeneric.RecordSource = strSQL
            Set rsGenericForm = frmGeneric.Form.RecordsetClone 'problem with this line
            Set rsGenericForm = frmGeneric.RecordsetClone 'also doesn't work
            
            Dim fld As Field
            Dim intControlNumber As Integer
            intControlNumber = 1
            
            For Each fld In rsGenericForm.Fields
                frmGeneric.Controls("lblGeneric" & intControlNumber).Caption = fld.Name
                frmGeneric.Controls("txtGeneric" & intControlNumber).ControlSource = fld.Name
                frmGeneric.Controls("txtGeneric" & intControlNumber).SizeToFit
                frmGeneric.Controls("txtGeneric" & intControlNumber).TextAlign = 1
                frmGeneric.Controls("txtGeneric" & intControlNumber).Locked = True
                intControlNumber = intControlNumber + 1
            Next
            
            Do Until intControlNumber > 10
                DeleteControl strGenericFormName, "lblGeneric" & intControlNumber
                DeleteControl strGenericFormName, "txtGeneric" & intControlNumber
                intControlNumber = intControlNumber + 1
            Loop
            
            Model_AlignBackButton
            
            'bind textboxes to recordset
            'choose how many manual text boxes i need
            'autosize all the text boxes
            'delete all unused text boxes
            'write proc to do with manaul textbox value with reference to pk of recordset
            'form level stuff e.g. title, full size
 
 
 '           DeleteControl frmGeneric.Name, "lblGeneric1"
'            frmNewForm("lblGeneric3").SizeToFit
    End Select

    DoCmd.OpenForm strGenericFormName, View:=acNormal

End Function

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Bitsqueezer
Bitsqueezer
Flag of Germany image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of developingprogrammer
developingprogrammer

ASKER

ah i see!! fantastic! now i understand it. thanks Christian!! = ))