When you open a query with paramaters as a recordset you need to do this
Dim qdf As DAO.QueryDef
Dim rs As DAO.Recordset
Set qdf = DBEngine(0)(0).QueryDefs("YourQueryName")
qdf("[Forms]![frmOutput]![ParamaterOne]") = getthevalue1
qdf("[Forms]![frmOutput]![ParamaterTwo]") =...
Try adding a list box or combo box to the form, it must have the record source set as the one you wish to query, the wizzard pops up, you have three options choose the bottom one and see how you get on. let me know if you get stuck...
It looks like it is treating all of the fields as one.
Try setting up an import specification when you manually import the file, then on the last or second to last tab click advanced and save as, the name that you save the import spec as put in between the commas.
acImportDelim, , "visiongeneral"
Like this, you need to start with a query then open recordset from there
Private Sub MyTest()
On Error GoTo Err_MyTest
Dim dbs As Database
Dim rs As Recordset
Dim x As Integer
x = 0
Set dbs = CurrentDb
'--new code
Dim qdf As QueryDef
Set qdf =...
Try this..
if y is a number then
x = nz(dcount("YourPrimaryKeyField","YourTable","WhichEverField=" & y ) ,0)
if y is a string then
x = nz(dcount("YourPrimaryKeyField","YourTable","WhichEverField='" & y & "'" ) ,0)
or with no Where
x = nz(dcount("YourPrimaryKeyField","YourTable", ) ,0)
Where to start :-)
* Your employee table should contain a field that contains the nt login you will need to add it if not there, this is used to look up the record that you require, call it what you want and replace the 'NTLoginField' with what you called it.
* Your form should have a data...
Not sure a few things to check.
Exactly which line did it break on?
The subform control has enabled and locked properties they should be enabled = yes and locked = no that seems the most likely for that error message.
Another thing is the subform control doesn't necessarily have the same...
Sorry I re-read your message.
What I normally do with this is, have a form that runs on the database open linked to the tblemployees table
logic being someting like
Private Sub Form_Open(Cancel As Integer)
Dim RetVal As Long
RetVal = Nz(DLookup("UserID", "tblemployees"...
In Default of the username field you can put
=Environ("UserName")
to return the nt login, this can also be used in a function like this
Public Function GetUserName() as String
GetUserName =Environ("UserName")
End Function
Here you go try trhis...
Public Sub Rsloop()
Dim rs As DAO.Recordset
Dim strSQL As String
'You can Limit your ID Number in the Recordset
strSQL = "SELECT * FROM [YourTable] WHERE [ID] = 1234"
Set rs = DBEngine(0)(0).OpenRecordset(strSQL, dbOpenDynaset)
If Not rs.BOF Then...
Could you show me the code? I would imagine something like.
'set date
DoCmd.OpenForm "frmYourForm", acNormal, , , , , #1/6/2006#
'now + 7 days
DoCmd.OpenForm "frmYourForm", acNormal, , , , , DateAdd("d", 7, Now)
Are you in the vba editor?
From excel right click the tab where it says "Sheet1" or what ever it is named, and select 'View Code' then paste which ever code you want into this part, if you have a function called Worksheet_Activate then it will run when the spreadsheet is opened.
Private Sub...