how to run the menu item 'data entry' from vba?

Jelle

New member
Local time
Today, 17:17
Joined
May 15, 2006
Messages
7
Is there any way I can run the 'records->data entry' menu item from my code, or is there an equivalent method?
 
Yes there is.

Form_yourformname.yourfieldname.DataEntry = True/False
 
Isn't that the property data entry, not the method in the menu?
The menu item i wish to use only appears with the form in 'form view', so I'm not sure if this is the same thing as setting the property.
 
Am I right in thinking you wish for the form to open in add only and not view any existing records depending on where you are calling the form from?

If so, you could set this when opening the form by using the above code.
 
No, I dont want to view any existing records at all. So I already have set the data entry property. In form view mode the data entry MENU item does exactly what i want (altough I can't find any help-info on it).
When the user is done entering a record, it needs to be send as a report to some email address (already have a button for that). After that, I want to invoke that menu item from my code so a new blank record appears.
 
solved

me.requery and the dataEntry property seem to do the trick.
 
DataEntry = False ???

Hi

I just read in the help file "Setting it to No by using Visual Basic is equivalent to clicking Remove Filter/Sort on the Records menu"

I would like to set a Toggle. so that if the there are search criteria, i should have the form's recordsource = myQuery (generated in VBA) otherwise i want it to stay blank and a new entry is showing but nothing else. i am pasting in the code, if anybody has some input please help.

thanks,

sam

Code:
    strSQL = "SELECT myTbl.* FROM myTbl "
    bolCondition = False
    
    If Not IsNull(Me.IDChoice) Then
        strTempSQL = "WHERE myTbl.ID = " & Me.IDChoice
        bolCondition = True
    End If
    If Not IsNull(Me.txtDateChoice) Then
        If bolCondition = False Then
            strTempSQL = " Where myTbl.DateWorked= #" & Me.txtDateChoice & "#"
        Else
            strTempSQL = strTempSQL & " And myTbl.DateWorked= #" & Me.txtDateChoice & "#"
        End If
        bolCondition = True
    End If
    If Not IsNull(Me.AChoice) Then
        If bolCondition = False Then
            strTempSQL = " Where myTbl.AgencyID= " & Me.AChoice
        Else
            strTempSQL = strTempSQL & " And myTbl.AID= " & Me.AChoice
        End If
        bolCondition = True
    End If
    If Not IsNull(strTempSQL) Then
        Me.DataEntry = False
    Else
        Me.DataEntry = True
    End If
    strSQL = strSQL & strTempSQL & " ORDER BY myTbl.DateWorked DESC;"
    Me.RecordSource = strSQL
    Me.Requery
 

Users who are viewing this thread

Back
Top Bottom