Since my last post was incredibly informative, and people seemed to get the wrong idea of what I wanted to make, I figured I would do a detailed version here. In my last post, someone mentioned I should enter code, I would, I really would, issue is, I've been working on every way I can possibly think for the past day, scouring Google, writing things that make logical sense but don't, with no results, to the point that I just deleted all my code and decided to start fresh.
So here is the pseudo code of what I want to try and do.
The user has a button on their interface saying '< Click and Press >
They click the button and the button changes it's text to '< Press a Key! >'
They then push any key on the keyboard, let's use 'K' as an example, and the button then displays the Virtual Keycode of that key. That being '75' so the button would display '75'.
This then gets stored in a variable where it can later be exported to a TXT document. (I know how to do this part for the most of it.)
I hope that sort of clears up some of the confusion that happened in my last post.
A couple of pages that might help...
Control.KeyUp Event
KeyEventArgs Class
Related
is there some way to repair broken functionality in ms access, like recompiling the thing?
I have a button on a form that is supposed to run vba code when clicked. The button no longer works, after like a couple of months. Except for the button getting focus nothing happens. I have tried the compact and repair option in access with no luck. The code works fine btw. I have made a new random button somewhere else on the form and literally copy pasted the vba code from the on_click event of the broken button to the new one, and on the new button it works perfectly. No problems at all. The old one, however, nothing. No matter what I do. I deleted the vba code in the on_click event, saved, closed and opened access again, then reentered the code. Still nothing. I tried removing certain functionality from the button by removing line by line, trying to see if any one line is the issue. Nothing again, no errors are being displayed, I don't think the button even runs the vba code at all.
In case someone wants to look at the code:
Private Sub Befehl107_Click()
[NavigationSubform].Form![stoffe_abfrage subform].Form.FilterOn = False
[NavigationSubform].Form![stoffe_abfrage subform].Form.Requery
Me.FilterAlleLink = "Alle"
Me.FocusDummy.SetFocus
End Sub
The button basically turns off the filter on a subform, requeries the form, sets the value for a textbox on the local form, and then gives focus to another textfield. Nothing complex really. I have 3 more buttons of the same type on my form that manage different filters for the same subform with almost identical code, they all work fine. Just this one broke.
Again, the code works fine if I make a new button, but on the old one it does not do anything.
Obviously I can just replace the button, but that would be annoying if down the line there is other functionality referencing it etc. So I was wondering if anybody encountered a similar problem and has a solution. Given that I have only worked with access for like 2 months total and already have this issue I hope there is some way to repair this more quickly, since I am now assuming that this will happen more frequently. Not sure though, maybe someone with more experience knows if this is common.
Edit: I just checked if literally copy pasting the broken button itself works and yes. I copy paste the broken button somewhere else, then copy paste the vba code from the broken button to the copy, and the copy now works...
So this is my setup:
A trivial NSWindow with a single NSTextField for user entry plus an 'Accept' type NSButton.
The window is displayed for my document window as a sheet using beginSheetModalForWindow:completionHandler:
I'd like to close the sheet when the user presses the escape key, however all I get is the funny system sound telling me it's not really expecting an escape key at that point.
There are several similar questions suggesting we should just check for cancelOperation somewhere in the responder chain. Thing is, my window controller (for the window/dialog in the sheet) isn't even in the responder chain when I'm checking it in the debugger.
For the sheet displayed in the way aforementioned the responder chain is still all about my document window. Weird.
So any hints how to properly hook up to either cancelOperation or the Escape key would be much appreciated!
Since your sheet can be cancelled, you should probably add a Cancel button to it to make that possibility clear to the user. If you do that, and set the keyboard shortcut of that Cancel button to the escape key in IB, then it ought to Just Work. I think it is important that the name of the button is actually "Cancel", though; I recall reading that AppKit does some special glue magic behind the scenes based on that button name.
And by the way, it seems like your window controller should be in the responder chain, assuming it is an actual NSWindowController set up in the proper way; see Apple's doc here. Not sure why the debugger indicates that it isn't, but it should be, as far as I can tell. If it really isn't, that might indicate something more deeply wrong with how you're setting up the sheet. I'm not sure about that, though, since I haven't tried it myself.
So I created a form, and have been using it for a while.
All of a sudden today it stopped working. Other forms load and can be viewed but not this one.
The weirdest part is that the controls still respond!
So I can't actually see the form but I can still interact with it. (only using keyboard no mouse clicks are responding) I know the form is enabled. But I simply can't see it! I have restarted excel, and the whole computer.
I even completely removed all code in the userform to see if I could get the blank shell to load, and while I can tell it loads (it disables everything in excel until I use Alt+F4) it still won't be visible. I have checked the Enabled, All Colors, Captiuon, Width, Height, Top, Left, StartUpPostion, SpecialEffect, Zoom, DrawBuffer properties and everything is fine.
I have also Exported and reimported it and still simply nothing. Also tried importing it into another Workbook, nothing. I at my wits end (not that it's very far to reach!)
Also, I can still see the userform in the designer I can still edit it, I get NO errors. This happens not only when calling the form in code, but even when running it right from the designer.
Any one ever have this issue? Any ideas or solutions?
The issue ended up being the Top and left properties. While I did check them, they way I checked them was not accurate; I still have no idea why, but I think it defiantly has something to do with dual monitor setup.
The way I tested double checked the forms top and left properties was by creating a new form and adding a button on the button click event I had a msgbox show the top and left properties of the form at time of clicking.
I then moved the new form to where I wanted the form that woudn't show to be and clicked the button; I then set these values to the form that wouldn't show.
I tested this location and made sure to match the properties with the values I wanted multiple times and it didn't work.
For some reason the values needed where about 1000 digits off (instead of 250 I needed to use 1250) even though I had set the form right where I wanted the new one to be and made sure to save the properties when they matched what I wanted
I got a problem with a form showing the follow ups of a proposal.
I made a form where you can navigate to the next follow up and the previous one.
The problem is that when I use the navigation buttons, it adds a follow up to the current proposal.
I realized that the follow up created is always the same one (the id is 83) and actually it's one made for another proposal. So every time I navigate, it updates this particular follow up and change the proposalId for the current.
here's the code for one of the navigation button:
Private Sub btnShowPrevious_Click()
Save
FindRecord "ID", txtParentID
End Sub
Because the wrong id is always the same (83), in the current form event I added an alert and found out that before to show me the good follow up, it always go to the 83 for a millisecond.
here are the steps to get this weird behavior
create new follow up and save
create his child and save
close the form
open parent or child follow up
use the navigation button
then it goes to the 83 before to show the good one.
If i press again any navigation buttons, it won't happen.
And if I don't close the form after saving and use the buttons, it works.
it's like if there's a default follow up id while he's looking for the follow up I request.
I don't know if it's clear.
I set the fetch defaults, the filter on load and allow filters properties to "No".
Also, when I open the form in view mode from the design mode, the default record is the 83.
so why when I do a findrecord it goes to the default record before to go to the good one?
EDIT
Finally, it's always the first record
Why it shows the first record when I do the findrecord before to find the good one.
Does anyone have an idea why this is happening
Thank you.
I got it...
I tested it in another project and while I was writing Findrecord I noticed some parameters were missing.
I checked and it was a method I made ( I don't remember why I made my own method for this)
There was a Me.Filter = "".. that was reloading the form to the first record.
Thank you
Access novice here. I've been using it for about a week now, and can do most things with enough googling and trial and error.
One question though, I have a form that Im using to add participants into the database. At present, i have 2 buttons, one that opens the MALE add user form, and then another button which opens the FEMALE add user form.
What i was wondering is, is it possible to create a main button (called "ADD USER" for example), that when pressed, shows the two other MALE and FEMALE buttons for the user to choose from?
Sorry if that makes no sense. Basically, can I make a button that when pressed, makes two more buttons visible?
Thank you for any help!
Yes, there are way to do this:
you could create those m/f-buttons and make a function which toggles visibility of your buttons on execution of addUser-button.
you could make an additional dialog, which is called by addUser-button
but my suggestion would be - use radio-buttons for male/female and their setup to execute addUser correctly ;) mainly, because I find this more intuitive and efficient.
like this, now you can access those to know which one is selected, or you can use a global variable or a property to be setup by those radio-buttons and then accessed by other objects, like an addUser-Button.
Hope this was clear enough - just try and look into those suggestions to find your way ;)