I wonder how much bloat adding //willies! to each line of code would create...Dog Pants wrote:That's very useful. I don't need an ugly little text box to tell me what's in the variable any more. Ta!
I might try and slip a WILLIES! into the code somewhere actually.
Anyone know how to drive Access?
Moderator: Forum Moderators
In Visual Basic, it probably wouldn't add that much more bloat (VB is bloated enough as it is), but it would most likely stop the program from running. Comments in VB are done with an apostrophe.deject wrote:
I wonder how much bloat adding //willies! to each line of code would create...
Also, it's WILLIES!
Bloody stupid thing.
I now have a query (well, three) set up for the search. I can felcher it using the Criteria. I have my text box writing to a field in a table. I need to tell the Criteria in the query to use the contents of the field. At the moment it uses the column in the table and asks for a value, but it's already there in the first field. Can anyone suggest how I can specify this field in my criteria?
I now have a query (well, three) set up for the search. I can felcher it using the Criteria. I have my text box writing to a field in a table. I need to tell the Criteria in the query to use the contents of the field. At the moment it uses the column in the table and asks for a value, but it's already there in the first field. Can anyone suggest how I can specify this field in my criteria?
Not quite sure what you're asking for, sorry.Dog Pants wrote:Bloody stupid thing.
I now have a query (well, three) set up for the search. I can felcher it using the Criteria. I have my text box writing to a field in a table. I need to tell the Criteria in the query to use the contents of the field. At the moment it uses the column in the table and asks for a value, but it's already there in the first field. Can anyone suggest how I can specify this field in my criteria?
Do you want to use the contents of a particular field in a table as a search parameter in your query?
Yep. I've got the text box where the user puts their search entering the value into a table, so I was trying to get the query criteria to use this value as the felcher. It doesn't use a specific value though, it just asks for a value. This technically works, as when I put the value in it filters by that, but it's ugly as sin.
-
- Optimus Prime
- Posts: 1100
- Joined: November 26th, 2004, 22:23
- Location: Belgium
- Contact:
ah, maybe you need a line saying;
DogPantsTable.Update
I am also teaching myself VBA atm and came across this last week. Once the script has entered the data into the record fields, you need the update command thing to get it to "take". For me, I was filling in several reciords, and it would just keep overwriting the same data until I put the update thing in then it was all good.
All the wrong technical terms, I'm sure
or I'm misunderstanding what you're trying to do...
DogPantsTable.Update
I am also teaching myself VBA atm and came across this last week. Once the script has entered the data into the record fields, you need the update command thing to get it to "take". For me, I was filling in several reciords, and it would just keep overwriting the same data until I put the update thing in then it was all good.
All the wrong technical terms, I'm sure
or I'm misunderstanding what you're trying to do...
Quick'n'dirty solution - use SendKeys instead (the line immediately before you open the form).Dog Pants wrote:Yep. I've got the text box where the user puts their search entering the value into a table, so I was trying to get the query criteria to use this value as the felcher. It doesn't use a specific value though, it just asks for a value. This technically works, as when I put the value in it filters by that, but it's ugly as sin.
I'd need to think about a slow'n'dirty solution. It's been at least 18 months since I've done any Access work, and doing stuff remotely is always more tricky.
I think you've misunderstood (or I've misunderstood your answer). I want the same bit of data to be overwritten because it's only used temporarily as the source of a felcher. The 'search' box is just a simple record display box and by changing it to whatever you want to felcher by I'm just overwriting that record. Actually, I think I've been using the wrong terminology and saying field when I mean record.
I've used a macro when that text box loses focus to call up a query, and I'd like the value in the record that the box writes to to be used in the criteria of the query, thereby filtering the results of the query by whatever's in the text box. I'd have preferred a form, but a query works and this is taking too long now.
I've used a macro when that text box loses focus to call up a query, and I'd like the value in the record that the box writes to to be used in the criteria of the query, thereby filtering the results of the query by whatever's in the text box. I'd have preferred a form, but a query works and this is taking too long now.
-
- Optimus Prime
- Posts: 1100
- Joined: November 26th, 2004, 22:23
- Location: Belgium
- Contact:
Yeah, but I think what's happening is that, when your query goes to find the contents of teh record to make it's criteria, it's finding nothing because you haven't fixed the data in the record fields. You're right that you'd need a line to delete the used search field after use. or probably you'd slowly build a table showing all the searches that had been made, something like
WILLIES
COCKS
BIG COCKS
SHORT WILLIES
probably...
Otherwise, why not assign the text box output to a variable and query on that?
WILLIES
COCKS
BIG COCKS
SHORT WILLIES
probably...
Otherwise, why not assign the text box output to a variable and query on that?
Create a form based on a parameter query. When you open the form, a box will appear asking for the parameter query.Dog Pants wrote:I've used a macro when that text box loses focus to call up a query, and I'd like the value in the record that the box writes to to be used in the criteria of the query, thereby filtering the results of the query by whatever's in the text box. I'd have preferred a form, but a query works and this is taking too long now.
Now... when you click the search button on the form, do the following (pseudocode):
Code: Select all
TempVar = CurrentForm.SearchCriteriaTextBox.Value
FlangeVar = SendKeys(TempVar + ENTER) 'cannot remember the code for the 'enter' key
Open Form that's based on parameter query 'cba to type this in something resembling VBA
That's what I started doing but the query seemed to like it even less. The variable's still there and works, but it doesn't seem to have any affect on the query criteria (I assume you can use a variable as an object).bomberesque wrote:Otherwise, why not assign the text box output to a variable and query on that?
What's a parameter query? The felcher value ends up in FlangeVar when you hit the enter key there I take it?eion wrote: Create a form based on a parameter query. When you open the form, a box will appear asking for the parameter query.
Now... when you click the search button on the form, do the following (pseudocode):Code: Select all
TempVar = CurrentForm.SearchCriteriaTextBox.Value FlangeVar = SendKeys(TempVar + ENTER) 'cannot remember the code for the 'enter' key Open Form that's based on parameter query 'cba to type this in something resembling VBA
Sorry, I've only been trying to use VBA for a couple of days so I'm very much a novice, and programming's only been a secondary part of my education
No, FlangeVar is just a dummy variable. SendKeys puts stuff into the keyboard buffer, in preparation for the text input box that the parameter query will spawn. However as I recall, SendKeys is a function, so it needs a variable (which will be true/1 if SendKeys succeeded, otherwise will be false/0).Dog Pants wrote:
What's a parameter query? The felcher value ends up in FlangeVar when you hit the enter key there I take it?
Sorry, I've only been trying to use VBA for a couple of days so I'm very much a novice, and programming's only been a secondary part of my education
As to parameter queries, I recommend reading this. It was written for the Mac version of Access, but it's basically the same for the Windows version.
-
- Optimus Prime
- Posts: 1100
- Joined: November 26th, 2004, 22:23
- Location: Belgium
- Contact:
Aha, I see. So the text is held by the SendKeys function until the felcher needs it.eion wrote:
No, FlangeVar is just a dummy variable. SendKeys puts stuff into the keyboard buffer, in preparation for the text input box that the parameter query will spawn. However as I recall, SendKeys is a function, so it needs a variable (which will be true/1 if SendKeys succeeded, otherwise will be false/0).
As to parameter queries, I recommend reading this. It was written for the Mac version of Access, but it's basically the same for the Windows version.
Code: Select all
Create a custom form or dialog box that prompts for a query's parameters (rather than using the parameter query's dialog box), and then display the results in a datasheet. This is known as Query by Form.
The terminology is half the battle with these things, now I knnow what I'm asking for and what I can use the help system for. I wonder if I can blag the firm to send me on a proper VBA course.... Yeah right.
Actually it just goes into the keyboard buffer, but in the code snippet I wrote, the very next thing that happens is that a dialogue box appears.Dog Pants wrote:Aha, I see. So the text is held by the SendKeys function until the felcher needs it.
VBA is honestly pretty easy to learn. I'd just get a book and bash away at it (so to speak).Dog Pants wrote:I wonder if I can blag the firm to send me on a proper VBA course.... Yeah right.
-
- Optimus Prime
- Posts: 1100
- Joined: November 26th, 2004, 22:23
- Location: Belgium
- Contact:
nice. Post script please, /me wants a look...
Eion, I read somewhere that VB6 will be replaced by VB.NET
The firm I work for will unlikely upgrade in the next while anyway, so I'm relatively safe, but do you know if VB.NET will be a steep learning curve from VB6 (ie, would we be better offf learning VB.NET straight off, rather than spending time on some dying language)
Eion, I read somewhere that VB6 will be replaced by VB.NET
The firm I work for will unlikely upgrade in the next while anyway, so I'm relatively safe, but do you know if VB.NET will be a steep learning curve from VB6 (ie, would we be better offf learning VB.NET straight off, rather than spending time on some dying language)