I swear I had tried it like that... turns out I had it try to write in the value from me.shop_code1 before finding the record that matched the user input...
Works just fine now dhookum, thanks! I put the code snippet in the right spot.
boblarson: I could have done it in the form data source...
Need to bring in "End_Date>=Date()"
To this:
DoCmd.OpenForm "Shop_Form", acNormal, , "[Shop_Code] =" & Me.Shop_Code1 & "", , acDialog
and include a couple different "if" scenarios to cover any cases where the date filter returns zero records
Just looked through my code when I noticed the filter was "disappearing"
I was putting in my own filter from a previous form in VBA. I'll have to incorporate the date filter in with my other coded filter, unless I can apply a "sub" filter.
Trying to do the following:
Filter records to show only those whose "End_Date" is equal to or greater than today. This will be set on the form properties.
I've tried the following:
End_Date>=Today()
End_Date>=Now()
End_Date>=Date()
All of the above with #End_Date#, and all of the above with...
I'm not sure how to go about this... I need to find the row.id of text in a cell COMMENT that matches a string.
Dim Rng2 As Range
If Trim(strTCrsName) <> "" Then
With Sheets("Transcript").Range("Q1:Q100")
Set Rng2 = .Find(What:=strTCrsName, _...
TM and TY are temporary strings pulling a formatted Month and Year from hidden columns on a combo box.
Filtering the year OR month only works just fine, but the string below with "AND" throws a runtime error 13 type mismatch.
strWhere = "Month([Expense_Date])=" & TM
'^ Works fine
strWhere =...
Make both the text box and command button invisible and use vba in the forms "OnCurrent" event to set the visible/enabled properties based on the checkbox. It'll show the appropriate item when you click (or use a navigation control to go the next/prev) on a record you want to work with, but...
On the "AfterUpdate" of whatever control you use to enter the status change, add code to make the change.
Ex:
If status=2 then
closed_by="Trent" (or whatever control/list/query)
MsgBox("Closed_By has been updated.")
else
endif
NameField=Environ("Username")[like Andrzejek said]
ComputerField=Environ("ComputerName")
works well for network and local users. Not sure why you'd need the massive chunk of code unless you were reformatting it (me.user to User, Me... etc)
This bit of code will search a text field and display matching records. It will search forrecords that contain multiple keywords, in any order.
Form/table items:
btnSearch-Button to initiate search
btnSearchClear-Button to show all records/clear search
txtSearch-Unbound text box, no default...
As a temporary measure, use VBA to disable the shift key. Set up a password prompt to re-enable it and share that password with the Project Leader, until you're done building their interface.
Disabling the shift key would be a good extra measure of security
Click the windows icon, and go to Access Options. Once there, select "Current Database" in the left pane.
Select your "login" form as the "Display Form:"
Uncheck the following:
-Display Navigation Pane
-Display Document Tabs
-Display Status Bar
-Allow Full Menu
-Allow Default Menu Shortcuts...
Well I found out that my code wasn't working exactly as intended.
It will write in the persons user name for "locker" but it will do it in the first record of the table, instead of the record that matches the combo box.
'Force a user selection
If Me.cmbSel.Value = "Select a shop" Then
MsgBox...
Absolutely, it is redundant... I started with the "Locked" field and added "Locker" much later to help generate a spiffy message box to help clue users as to who might be working on their shop, and help me figure out who force-closed access.
Redundancy removed, and code is a lot cleaner now...
That second chunk of code didn't match up the shop_code.
I worked around the issue by changing from a grid of buttons to one combo box. Code is below:
If Me.cmbSel.Value = "Select a shop" Then
MsgBox ("Please select a shop first.")
Else
If Me.cmbSel.Column(1) = 0 Then
Me.Locked.Value = 1...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.