ACCESS CRASH with this Code

I2omani

Board Regular
Joined
Feb 8, 2007
Messages
85
Code:
=DLookUp("StaffName","tblStaff","Login='" & Forms![Logbook Form Continuous]!User & "'")

when i open Logbook Form Continuous Form , :oops: access will crash.

i have table "tblStaff" with:

*->[Login], [StaffName]
tdax Tim Dax

*-> there is a hidden field:
[txtModBy] = Environ("username")

what i am trying to do is that when i open form [Logbook Form Continuous] . Field [User] in that form will LOOKUP "tblStaff" and match the [login], to [StaffName] and then put the personnel name in [User]
<CENTER><TABLE cellSpacing=0 align=center cellpadding=2px width=50% ><TR ><TD CLASS="AccTBMain" border-left=1px solid colSpan= 3 ><TABLE width="100%" align=left VALIGN="TOP" ><TR ><TD CLASS="AccTBInner" align=Left ><font color="White">tblStaff : Table</font></TD><TD CLASS="AccTBInner" align=right >Access 2003</TD></TR></TABLE></TD></TR><TR ><TD CLASS="AccHDRLeftElem" >
</TD><TD CLASS="AccHDRMain" align=left >Login</TD><TD CLASS="AccHDRMain" align=left >StaffName</TD></TR><TR ><TD ID="currRec" CLASS="AccHDRLeftElem" >
</TD><TD CLASS="AccDataElem" >ribrahim</TD><TD CLASS="AccDataElem" >Romani Ibrahim</TD></TR><TR ><TD ID="currRec" CLASS="AccHDRLeftElem" >
</TD><TD CLASS="AccDataElem" >bmartinez2</TD><TD CLASS="AccDataElem" >Ben Martinez</TD></TR><TR ><TD ID="currRec" CLASS="AccHDRLeftElem" >
</TD><TD CLASS="AccDataElem" >dreynolds</TD><TD CLASS="AccDataElem" >Denver Reynolds</TD></TR><TR ><TD ID="IE" CLASS="AccIEOnlyMain" colSpan= 3 ><TABLE width="100%" align=left VALIGN="TOP" ><TR ><TD CLASS="AccIEOnlyInnerRight" > Record: </TD><TD CLASS="AccButton" >
</TD><TD CLASS="AccIEOnlyData" > 1 </TD><TD CLASS="AccButton" >
</TD><TD CLASS="AccIEOnlyInnerLeft" > of 3</TD></TR></TABLE></TD></TR><TR ><TD CLASS="AccIEOnlyMain" colSpan= 3 ><TABLE cellSpacing=0 cellPadding=0 width="100%" align=left VALIGN="TOP" ><TR ><TD ID="Data195659816" CLASS="AccInfoBarInnerRight" >tblStaff</TD><TD ID="Info195659816" CLASS="AccInfoBarData" > Record Count: 3</TD></TR></TABLE></TD></TR><TR ><TD CLASS="tpkrow" colSpan = 3 ><CENTER><font size = 1>Access HTML Add-in provided by theprimarykey.com</font></CENTER></TD></TR></TABLE></CENTER>
 

Some videos you may like

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

SydneyGeek

MrExcel MVP
Joined
Aug 5, 2003
Messages
12,251
I reproduced your form and table names, used the same expression, and it worked just fine.
Are you using this on a single form, or is this a multi-record form? It is designed to be used on a single form (the multiple records are irrelevant, because the form itself is unbound and it is used purely as the gateway into database).

Also, the controls in this example need to be unbound -- ie, the control source should not be a table name.

Denis
 

Watch MrExcel Video

Forum statistics

Threads
1,123,318
Messages
5,600,925
Members
414,416
Latest member
Nobu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top