Manipulate Cuser Variable Through Code

Mar 1, 2007

Would anyone know if there is a way to manipulate the current user value through code. I have a database and have all users signing on via the Admin user (basically not activating the password on the Admin user). I have a form that does request a password and username, which I use to allow access to various forms, etc. I know I could have done this through access security, but I needed to add some specific rules on the sign in that cannot be done through the standard access security sign-in. I am then able to store the username given at sign in and use this to allow or disallow access to various forms. I can also track when people sign in and sign out using this method.

Anyway, what I would like to do know is be able to set the system currrent user cuser variable to the user name they signed in with , and my reason for this has more to do with possible record locking conflicts if everyone effectively signs in as admin.

Is there a way to change the cuser variable through code ??


Thanks
Jackson

View Replies


ADVERTISEMENT

Variable - Code Behind Report

Mar 16, 2006

I am trying to create a report which is sorted by KeyID, CustID. I don't want to display every Customer record but in the KeyID Footer I would like to display all CustID's associated with the KeyID. I have attached a sample mdb.

TIA,
Valerie

View 1 Replies View Related

Using Variable In Filter Property (in Code)

Mar 28, 2006

Hi.

Me.Filter = "Country = 'USA'"
Me.FilterOn = True

can i use a variable instead of the text 'USA'

give me an example if any pls.

thanks for help.

View 2 Replies View Related

Modules & VBA :: SQL Code Return Value And Set To Variable?

Sep 4, 2013

Code:
Dim dbs As DAO.Database
Dim rs As DAO.Recordset
Dim SQLstr As String

[Code]....

I created this about 1 hour ago but my laptop crashed and didnt save. So, I open a record set and rs is now loaded with the record I want,

how do I assign the value of "Status" as a vba variable. when I try StatusInt = rs I get the "Type Mismatch" error...

View 4 Replies View Related

General :: Content Of Variable Crashes VBA Code

Jun 16, 2015

I have a form I use to create photo captions. The form has a field where users can edit a pre-generated caption and a field that stores their updates as a final caption in the field "selected_caption".. On my form is a button that runs the code below to check and see if a field ("updated") has been marked true, then copies the content of caption field into the selected_caption field. It works fine 90 percent of the time but for some reason this caption:

LA 109535, LA109535 partial site overview showing blowout with PL's 01- 04. Crew person is excavating a shovel test probe. Photo direction facing southwest. (Roll 31066, Frame 4958)

Results in a missing operator error. I thought it was like a special character thing, so I removed the "'" and the "-". Same error.

Code:
Dim db As Database
Dim rst As Recordset
Dim upcap As String
Dim strSQL As String
Set db = CurrentDb

[Code] .....

View 4 Replies View Related

Manipulate Data

Apr 11, 2006

Please try help!

I want on my form some field to connect to field in other table. I would like, when I open form and insert txtName, verify if in field on other table precede that value, and if exist. If exist then find that recordset and open. But if that field don’t exist, open other form and fill that value.
Set rst = New ADODB.Recordset
With rst
.ActiveConnection = CurrentProject.Connection
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open "Select * from vFizickoLice"
.AddNew
' !DeteJMBG = Me.cmbDeteJMBG
!DetePrezime = Me.txtDetePrezime
!DeteIme = Me.txtDeteIme
.Update
Me.cmbDeteJMBG = !DeteJMBG
End With

View 1 Replies View Related

Manipulate A Pivot Table

Apr 4, 2007

Is there a way that you can manipulate a pivot table, (example adding more item in a list) after the pivot table is created.

View 5 Replies View Related

Proper Way To Look Up And Manipulate Files

Mar 2, 2014

I am trying to build a DB to fix movie folders and file names and I am struggling to properly find the file names.

Currently I am using "DirectoryName = Dir(folder, vbDirectory)" to find the files and loop through them correcting the names as I go.

Works perfect.

The issue I am having is how to properly then look up the file within the folder since Dir is already in use for the loop.

The straightforward question is how does one look-up a child file when the parent is known without using Dir().

Below is what is works to rename parent folders. I am sure it is hack to the trained eye but it gets the job done.

folder = "E:Videos"
DirectoryName = Dir(folder, vbDirectory)
Do Until DirectoryName = ""
If DirectoryName <> "." And DirectoryName <> ".." Then
If (GetAttr(folder & DirectoryName) And vbDirectory) = vbDirectory Then

[Code] .....

View 3 Replies View Related

Tables :: Manipulate Table With LINK To Data From SQL

Feb 25, 2015

I've nearly cracked where I want to be. I have essentially had to do the core of the back-end in SQL in order to organize the data in a way that actually makes sense to ACCESS.

Following this I now have a table with the following fields

Stock No
SK Code
Free Stock Qty
Stk Qty Pd
Actual Min
Actual Max
Forecast EoM
Forecast +1Month
Forecast +2Month

Essentially this is a stock forecast sheet. It takes into consideration incoming stock and estimated usage to provide an output as a "Forecast" stock level at the end of the forthcoming months.

The next phase of developing this is to allow users to manually change the front end by Group and Part Number with Quantity entry so that it auto updates the Estimated EoM, +1Month or +2Month figures depending on which month figure they are looking at. In addition, this information would need to be retained and ideally stored as individual tables or other .

View 2 Replies View Related

Queries :: How To Manipulate Find Duplicate Query

Jun 15, 2013

I am trying to manipulate a find duplicates query using the following criteria:

Fstnm L2, Lstnm L5, Add1, Zip

This is what I have done so far:

SELECT [Duplicate Identification Dataset].[FSTNM], [Duplicate Identification Dataset].[LSTNM],
[Duplicate Identification Dataset].[ADD1], [Duplicate Identification Dataset].[ZIP],
[Duplicate Identification Dataset].[ID], [Duplicate Identification Dataset].[MIDNM],
[Duplicate Identification Dataset].[SPFSTNM], [Duplicate Identification Dataset].[SPMIDNM],

[Code] .....

View 1 Replies View Related

General :: Manipulate Forms - Adding Two Columns

Jul 13, 2014

Access file attachment in the form below if you want to add two columns (like other columns with the capability to filter).

Link file attachment : [URL] ....

View 14 Replies View Related

General :: Macro To Manipulate Unstructured Data

May 5, 2015

I have some tables need to be imported to Access, which is not well structured. For example:

report
4/05/2014
from SQL server
Name ID Add.....
aaa 111
bbb 222

To be more specific,I have 4 csv files, that need to be imported into Access.

1. I'm building 4 linked tables so users can update the table as needed. Then run queries based on these tables to produce report. But maybe there's a better way? the file name and location might be dymatic, so anything like 'getopenfile' would be easier instead of linked tables?

2. These data need to be clean up first to become a 'database table'. (Delete first 2 rows, delete some columns, remove duplicates etc.) I know how to do them in VBA Excel, but never used Macro in Access before.

View 1 Replies View Related

Modules & VBA :: How To Manipulate Data Export In Rows To Become In Columns

Oct 14, 2013

The key field is the specimen number and specimen type. Currently for every antibiotic there is a row with its result. My output is 3 complete worksheets so a lot of data. I need to create a database with one row per specimen number/type to include whether it is S/R/or I for each type of antibiotic. The example probably makes more sense. but I'm assuming that 65000 rows * 3 sheet can then be reduced to around 18,000 rows.

View 4 Replies View Related

Manipulate Data By Changing One Of Columns To Lookup Field

Aug 16, 2011

manipulate the data by changing one of the columns (Customer 1) to a Look Up Field. This has created two challenges for myself:

1) The data is gone ... oops. I can solve this one.

2) More serious, that column (Customer 1) will only display primary key numbers of the data. Before the corruption, I had a combo box on a form. This combo box took its values from a Table called CustomerTable, the value in this combo box was stored in the QuoteListTable. Before it showed names, now only primary key.

I have attempted to:
-change the look-up back to a regular field (got rid of the look-up)
-exported the table to a query, turned it back into a table, no change.

View 1 Replies View Related

Reports :: How To Manipulate Zeroes In A Unit Price Field In A Report

Jul 2, 2013

I have created a report and, in the unit price field, I have set the decimal place to 5 in the report properties. Sometimes we have pricing for items up to 5 decimals long, such as $10.02985. It is rare though, so I'm to see if there is a way to have it drop the zeros down to 2 decimals when more is not needed. I'm thinking maybe a VBA event might work, but not sure.

View 12 Replies View Related

Reports :: Subform Field Linker Error - Obj Variable Or With Block Variable Not Set

Apr 16, 2013

I am creating a 2 level report to confirm an order. Main report already created, runs successfully called as subform/subreport under "OrderDetails" form. Linked to master using Order.ID. There are two versions of the confirmation report that have different layouts for different program types.

The hangup comes when I try to add a "Class Dates" subreport. It lists dates of individual classes and Skip dates. I have created the subreport as "srClassDates". When I add it to the main report, it lists the records. However, when I try to link it to the Main report, an error message box appears with the "object variable or With block variable not set".

I have tried rebuilding both the main and subreports, rebuilt the query, have not found anything that changes the result.

Linker has been working successfully on other subforms. Report with groupings works fine, but I need data from 2 tables both linked to order.id.

View 2 Replies View Related

Modules & VBA :: Error 91 - Object Variable Or With Block Variable Not Set

Jul 8, 2013

Error 91 - Object variable or With block variable not set

I am getting this error telling me that an object variable is not set.

I know which variable it is but when I step through the debugger it sets the variable and all is fine? Issue is that public variable of a class is not getting set when the VBA Editor is not open?

View 14 Replies View Related

Modules & VBA :: Sorting / Object Variable Or With Block Variable Not Set

Oct 3, 2014

This code runs fine the FIRST time, however trows up a message the SECOND time it is run.

The error is on the line ".Range"

I am trying to sort records which have been exported to Excel.

Dim LR As Integer
LR = 5
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set wbRef = xlApp.Workbooks.Add
With wbRef

wbRef.Activate
.Worksheets("Sheet1").Activate
With ActiveSheet
.Range("A2", .Cells(LR, "O").End(xlUp)).Sort Key1:=.Range("C2"), Order1:=xlAscending, Header:=xlYes
End With
end With

View 3 Replies View Related

Modules & VBA :: Update Contents Of Variable But Not The Variable Itself?

Aug 20, 2014

I look at a lot of files to see when they were last updated. I wanted to write a generic procedure to manage that so ..

Code:
Public fDate As Variant
Public vField As String
Public vFile As String

'GTSdata
vField = "txt_gts_data"

[Code] ....

What I hoped Me.vField would do is update the date field [txt_gts_data] on my form with the date the file was last saved.

i.e. me. txt_gts_data = fDate

What actually happens is the variable vfield gets updated from "txt_gts_data" to 19/08/2014 then later code falls over because the fieldname is lost .

Me.[vField] corrects itself to me.vField (and does not work)
Me!vfield falls over (cannot find the field vField, not surprising J)

How do I say update the contents of the variable, not the variable itself?

View 7 Replies View Related

Reports :: Object Variable Or With Block Variable Not Set

Apr 15, 2015

Runtime error '91'

Running Access 2010.

I have two reports running off of the same crosstab query. I copied one report to make the second report, then modified the second report to change the background of column fields satisfying certain conditions. These lines of code were added to the Detail_Format section, in color below. The report with the extra code lines does not error--the original report errors.

Code:
Option Compare Database
' Constant for maximum number of columns EmployeeSales query would
' create plus 1 for a Totals column. Here, you have 9 employees.
Const conTotalColumns = 11

[Code] .....

If I say OK (rather than debug) after the error message, I can then click the button for the report again and it runs without complaint. And, as I said, the report with the added code never errors.

View 4 Replies View Related

Object Variable Or With Block Variable Not Set

Apr 23, 2006

I have a networked database. It is accessed with computers that have both Office 2002, and office 2003. I get the following error message on computers with Office 2003:

"Object variable or With block variable not set"

It happens occasionally and the problem generally fixes itself so I dont think there is anything wrong with my coding.

And when it happens on the computers with office 2003 the ones with office 2002 can open the database fine.

What can be causing this?

Thank you in advance

View 1 Replies View Related

Object Variable Or With Block Variable Not Set

Dec 14, 2006

Good afternoon all,

The following block of code was working great until I came into work this morning. This routine is called from the OnClick event of several combo boxes. When it does, I recieve the error listed above (Object variable or With block variable not set) on line:

If Me.cbxAss_Filter <> "All" Then

Any ideas? I'm running on no sleep in the last 24 hours so I'm sure I'm missing something simple

The code itself checks the contents of a form and builds a string of conditions which I apply to the Form's filter property to filter records.


Code:Public Sub CreateFilter() '************************************************* **** 'Name: CreateFilter 'Purpose: Generate a string to filter the form 'Inputs: None 'Outputs: None 'Instigates: Me.Filter ' 'Updated: 11/30/06 'By: Chris Lounsbury '************************************************* **** 'Vars Dim strFilter Dim lngLength As Long strFilter = Null strFilter = "" 'Each filter box has its own check for contents If Me.cbxAss_Filter <> "All" Then strFilter = "assigned = '" & Me.cbxAss_Filter & "' AND " End If If Me.cbxAction_filter <> "All" Then strFilter = strFilter & "action = '" & Me.cbxAction_filter & "' AND " End If If Me.cbxStatus_filter <> "All" Then strFilter = strFilter & "status_rsrch = '" & Me.cbxStatus_filter & "' AND " End If If Me.Combo34 <> "All" Then strFilter = strFilter & "rims_flags = '" & Me.Combo34 & "' AND " End If If Me.cbxAAMB_filter <> "All" Then strFilter = strFilter & "aamb = '" & Me.cbxAAMB_filter & "' AND " End If 'Check if filter string was built If strFilter = "" Then Me.FilterOn = False Else 'Determine length of Filter String 'minus the trailing ' AND' lngLength = Len(strFilter) - 5 'Chop off ending ' AND' and set the form filter If lngLength <= 0 Then Else Me.Filter = Left(strFilter, lngLength) Me.FilterOn = True End If End If 'debug 'MsgBox (strFilter) End Sub

View 1 Replies View Related

Please Help: "object Variable Or With Block Variable Not Set"

Mar 1, 2006

I get this error message, " object variable or with block variable not set", when I'm in the design view of a form wanting to use the command button wizard. Using a brand new database/blank I imported a table from my database in question. I then tried to make a new form and put a button on it. It worked for awhile but then when I close the database and reopen it to add another button to the same form, I get the error message again. It isn't a problem that is specific to my homeschool database. It affects all the database I use/maintain as well as any new "test" databases I've made trying to figure out this problem. I looked at references before and after the error occurs and there is not difference. I've also looked at code but don't see anything code that requires variables to be defined. In the case of the test database with one table and one form there is no code to look at until I make a button before exiting and even then, I don't see anything weird.

I would appreciate any help you can offer.

I've attached the original database I was working on when the problems began.

Is it possible for a database program to adjust security levels on certain reference libraries when installed on ones computer, thus making all other database act up that are using those libraries?

Thanks,
Kris

View 3 Replies View Related

Please Review This Code, (simple Code) New With Codes

Feb 16, 2006

Works great, but when I hit the number "3", (3 times in row) it will let me into the form. I want it to not let me in IF I don't know the password.

Where did I go wrong?

Private Sub Form_Load()
Dim pw As Variant

If InputBox("What is the password?", "Password") = "1" Then
Else
MsgBox "Invalid Password", vbCritical, "Sorry Charlie"
DoCmd.Close
If InputBox("What is the password?", "Password") = "2" Then
Else
MsgBox "Invalid Password", vbCritical, "Sorry Charlie"
DoCmd.Close
End If
End If


End Sub

View 14 Replies View Related

Using Code To Unprotect And Protect Viewing Code

Jan 14, 2007

I protect my code from people being able to read it by setting a password on the code from Tools > Properties, selecting the Protection tab and entering a password, and clicking "Lock Project"

Is there a way to write code that will remove that Lock Project check and check it back on?

I've looked through the Application.SetOption command and it doesn't seem to be one of the choices. It would be very helpful if someone knew how to do this.

Thanks

SHADOW

View 6 Replies View Related

Variable Help

Apr 25, 2008

Hi All,

Getting myself in a pickle with variables & forms so any help on the following would be appreciated.

I'm building a client management database and currently have the following setup:

1) tblclientdetails (primary key cdid)
2) frmclientdetails (record source tblclientdetails)
3) cmdopenques (opens frmhealthcheck)
4) frmhealthcheck (record source tblclientdetails)

Once client details have been entered into frmclientdetails and the user has clicked cmdopenques, I would like frmhealthcheck to default to the client details entered. I've tried setting variables in VBA & using a queries/pop ups but can't seem to get this to work

Any help/instructions would be great

Thanks!

Jules

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved