I have cboUtilizator (User) for choosing username, txtp for password input and a text box called lngEmpID wich Control Source =[cboUtilizator]. The user select his username, enter his password then when he click the OK command button the code verify if the password is correct for selected user, and if it's correct based on lngEmpID, opens a ChangePassword form showing the user data. This way he can change only his password, 'cause this is the only information he can access. The problem is: If I put this code
Dim stDocName As String Dim stLinkCriteria As String stDocName = "ChangePass" stLinkCriteria = "[lngEmpID]=" & Me![lngEmpID] DoCmd.OpenForm stDocName, , , stLinkCriteria
to a command button, it's OK. But if I insert it in the code, the way showed bellow, it isn't working anymore, on the line
stLinkCriteria = "[lngEmpID]=" & Me![lngEmpID]
it give me the following error message: "Run-time error '2467' The expression you entered referes to an object that is closed or doesn't exist."
Can anybody help me to fix this?
Thanx, Attila
Private Sub Command5_Click()
'Check to see if data is entered into the UserName (cboUtilizator) combo box
If IsNull(Me.cboUtilizator) Or Me.cboUtilizator = "" Then MsgBox "Va rugam introduceti numele de utilizator.", vbOKOnly, "Completare obligatorie" Me.cboUtilizator.SetFocus Exit Sub End If
'Check to see if data is entered into the password box (txtp)
If IsNull(Me.txtp) Or Me.txtp = "" Then MsgBox "Va rugam introduceti parola.", vbOKOnly, "Completare obligatorie" Me.txtp.SetFocus Exit Sub End If
'Check value of password in table users (Utilizatori) to see if this matches value chosen in combo box
If Me.txtp.Value = DLookup("Parola", "Utilizatori", "[lngEmpID]=" & Me.cboUtilizator.Value) Then If DLookup("TipUtilizator", "Utilizatori", "[lngEmpID]=" & Me.cboUtilizator.Value) = "Admin" Then lngMyEmpID = Me.cboUtilizator.Value
Dim stDocName As String Dim stLinkCriteria As String stDocName = "ChangePass" stLinkCriteria = "[lngEmpID]=" & Me![lngEmpID] DoCmd.OpenForm stDocName, , , stLinkCriteria
Else
Dim stDocName4 As String Dim stLinkCriteria1 As String stDocName4 = "ErrLog" DoCmd.OpenForm stDocName4, , , stLinkCriteria1 Me.txtp.SetFocus End If End If
I have an append query which runs from a command button. It transfers all the fields I want it to but when I run the query when in one particular record it not only appends the field for the current record but appends the fields for every other record in my table. I know I should be running the query using stLinkCriteria but I'm not sure on the syntax for the code, see below:
:mad: and tearing out my hair with this one... Someone out there please help:
I have a form that should open, linking to the date on another form (that is changeable using a Calendar Control), and display records for that date.
My underlying data is available for a variety of dates but some of the dates (and therefore the records) will not appear when this form opens.
They will all show if the form is opened without the filter. Or they will show in a report. So I know that the coding is correct. This intermittent-type thing is really bugging me.
Have even tried re-typing some of the dates in the table in case the format has somhow got changed.
Private Sub btncard_Click() Dim stLinkCriteria As String DoCmd.RunCommand acCmdSaveRecord stLinkCriteria = "[jobref]=" & "'" & Me![jobref] & "'" DoCmd.Close DoCmd.OpenForm "k_job_card", , , stLinkCriteria End Sub
this button code opens the k_job_card form.
the form opens and says 'Record 1 of 1, (Filtered)
i have a control on the form that opens.. and i am simply trying to assign a default value to that control..
it is a textbox.. for my jobtype field (text datatype)..
is there any particular reason why i cannot assign a default value to a control if it has been placed on a form that has been opened using a form filter?
this is how the Form Data tab is set at the moment..
I have set up a database that stores actions (i.e jobs). In the table; two of the fields are...'required completion date' and 'actual completion date'. I wish to lookup, by using a query, all of the open actions (those which havent yet been complete (i.e the 'actual completion date' is null)) and then later on all those which are overdue (i.e the 'actual completion date' is null And the 'required completion date' <today....this being the criteria for an overdue action).
However, I have used a form which has a combo box which contains the values open and overdue. When a selection has been made I want a form to display with the results depending on the selection that has been made. I am capable of creating a form based on a query, but am unsure of how to construct the query with the correct criteria based on the option that is selected from the form.
I created a form that allows the user to choose the criteria that they want to see on a report using =Forms!formname!controlname in my query. It works great but I want to also allow the user to choose nothing and return all records instead of limiting them to choose just one type of record. Is this possible? Before I created the form my query had the [Enter parameter] on one criteria line and [Enter parameter] Is Null on the next criteria line and that was working great for my use but I need to create a simple form for other users.
I have data for hundreds of stores. The data was pulled for the top 15 items by store, so I cannot obtain only the top 5 items that I need. How can I query this data to extract only the top (or bottom) 5 Subjects, by store, based on the percentage column?
Folks, i have a small problem wizzing my nut. I copy two tables from mycurrent database to an external database,now i am trying to link these two tables in the external database to the ones in the currentdb. I get a run-time error 3012 telling me that an object 'tblLanguage' is already present.which iam failing to track. Any ideas Please?? Here is my linking code. Sub LinkMeUp() Dim tbl As DAO.TableDef Dim sTableName As String Dim sThatTblpath As String Dim dbName As String dbName = "my_ExternalDatabase" sThatTblpath = ";Database=" & db_Path & "" & dbName
For Each tbl In CurrentDb.TableDefs sTableName = tbl.Name Set tbl = CurrentDb.CreateTableDef(sTableName) tbl.Connect = sThatTblpath tbl.SourceTableName = sTableName CurrentDb.TableDefs.Append tbl Next tbl End Sub
The current database I am working on I made it by copying the one I was working on originally. I just realized on the VB window that there is still some relation between them. Because, if I look at the tree on the left of the code window I see it says "GCB (miniGCB)", being GCB the one I copied, and miniGCB the one I am working with.
How can I get rid of the link with GCB?? I want the tree to just say "miniGCB".
I created a table and linked a pdf file to one of the fields, but when I created a form to display the table contacts, I could not see the attachment or icon or any reference to the linked object. The field in my access table is an OLE object.
I have packaged an Access DB (Split) as a run time solution so I can distribute to users without Access.
When I install it on a PC it runs.
If I move the back end to a network, the solution can't find the back end because it has been moved.
Access run time does not include the linked table manager in the toolbar.
Is there code in VBA where I can refresh the link between front and back end.
Ideally I want to write an error handler that will call a sub to prompt the user for the new location of the back end if it has been moved. Then have the user browse to the network location and click on the back end and store that location as a string. Using that string refresh the links.
I have added about 15 links on a form, linking to word and excel documents. The word documents open fine but all of my excel documents pop up with a messae saying the file cannot be open, yet when i just go to the document on my hard drive they all open fine...does anyone have any ideas please. Thanks
I have an excel document which automatically refreshes data gathered from an access db. I need to put a button on the switchboard on the same db to open the excel document, basically to make it easy for others to find. I have tried hyperlinks but it doesn't want to play. It locks the db and then won't refresh the information. I know i'm missing something blindingly obvious, can someone help?! :confused: Thanks elsiegee
Hi Forum, I'm building a db to track computer and user problems for work, where I double as a Client Support Administrator (IT Guy). I have these tables: (simplified list)
I'm at a loss as to how to link the 'Problems' table. This is where I'll record trouble tickets reported by users. Incoming trouble tickets could relate to the Computer or to the User's Network Login. I thought I might have a field in the problems table for UserName and also one for ComputerID, but this seems problematic. Anyone got any ideas?
I am trying to link to a url from a message box with difficulty. eg the user opens the form and a message box appears asking have the latest datasets been downloaded? If answered yes the form opens, if no links to web address.
Does anyone know how to link tables automatically/VBA?
I'm trying to import files from our DB2 database in which one file is created monthly and instead of manually importing / linking the files manually, I'm looking to have access link to the new file automatically.
I enter data in a form "WIP" that is based on a table named "WIP" in the form I have a command button. When I activate the command button it takes me into another form "Materials" which is based on a table named "Materials".
The data that I enter into "Materials" is not linked to the data ie Customer details which I have entered into "WIP".
My aim is to be able to report the materials used.
I have tried variations of relationships but am obviously missing something.
Is it possible i create one master table and link few table together?? In the mdb that i attached there have 3 table - tblMaster, tblConfiguration1 and tblConfiguration2. Using the relationship to link tblMaster's field Configuration to other 2 table Configuration field but there only showing 1 table data. Is it allow in tblMaster able to show this 2 table together??
I have a FE database that on initial setup the user will enter the drive letter of the mapped location where the BE resides. The FE will then update all the linked tables to that path. This should work but for some reason the FE locks up (stops responding) when I test this. Any suggestions as to why. It doesn't stop responding until this part of the code:
tdf.Refreshlink
I have looked and it does change the link path, but it locks up.
Dim dbs As DAO.database Dim dataPath As String Dim tdf As DAO.TableDef dataPath = Me.drive & ":IMP1_R2.2_be.mdb" For Each tdf In dbs.TableDefs 'Not a MSys type table 'If the table has a connect string, it's a linked table. If Len(tdf.Connect) > 0 Then If InStr(tdf.name, "MSys") = 0 Then tdf.Connect = ";DATABASE=" & dataPath End If err = 0 On Error Resume Next tdf.RefreshLink End If Next tdf DoCmd.Echo True, "Done"
i have a button that open another form. the form should copy some filed from the form that the button in it.
Example. i have the from-A with field name- ID. in this form there is a button that open form-B. this form had also the field ID and another fields of information on the specific person (with the same person form the form_A) i want that the ID will automaticlly updated whrn i open the form so i can add another information. these are teo tables that are linked together and that is the reason that witohut the ID it cant be updated, and i dont want to update it manually.
i have a cars database because it is difficult to add 4000 pictures i want to know if is it possible to add a field that opens an ie page in google images to show results of images for that car? ex : model : Ferrari foto link :http://images.google.com.gr/images?hl=el&lr=&q=Ferrari&btnG=%CE%91%CE%BD%CE%B1%CE%B6%CE%AE%CF%84%CE%B7%CF %83%CE%B7