home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

VBA DoCmd.FindRecord ?

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 2161
Discussions: 200,972, Posts: 2,379,771, Members: 246,336
Old January 13th, 2003, 07:29 PM   Digg it!   #1 (permalink)
Member
 
Join Date: Nov 2001
Posts: 177
VBA DoCmd.FindRecord ?

I'm trying to create a button on the start up form that allows the user to jump to a specific record on a certain form. I've found sloppy solutions, but I'd like the code on this one to look nice so I'm trying to figure out the correct way to go about doing this. My most recent attempt consists of a button on the start up page that opens up a form called frmFind, and a form called frmBody. On frmFind, there is a text box and a button. The text box sets the value to a global variable, and then searches for the first instance of that value, a string, in frmBody, and opens that record. (any of this making sense so far? I'm terrible at trying to explain my coding) My code for the button is as follows:
1 Screen.PreviousControl.SetFocus
2 gSearch = txtTitle.Text
3 Forms!frmBody!txtTitle.SetFocus
4 DoCmd.FindRecord gSearch, , , , , acAll
Line 1 to send focus back to the text box so line 2 will work, line 3 to switch focus to frmBody, the form I want the record to open up in, and line 4 the actual FindRecord action. The error message I keep getting is : "A macro set to one of the current field's properties failed because of an error in a FindRecord action argument." Any help would be appreciated, especially if I'm going about this all wrong If there's a better approach to take, I'm open to them, but I'd like it to be extremely simple (for the end user) and I'd rather not use the built in find function. Thanks.
Turnip12 is offline   Reply With Quote
Old January 14th, 2003, 10:26 PM     #2 (permalink)
Banned
 
qball's Avatar
 
Join Date: Oct 2001
Posts: 447
I'm likely no VBA help here, but maybe process, then you implement.

Quote:
I'm trying to create a button on the start up form that allows the user to jump to a specific record on a certain form.

do you mean a specific DB record/row and specific form? forms don't really have records, they show records that exist somewhere, or not (could be totally made up).

anyway, this should be no problem, kinda sorta...

to do this correctly, you need to find out what record on what form the user desires. This could be non-trivial, as thousands of forms may exists that access millions of DB rows. As it seems you are using a GUI (VBA) in a client/server enviroment, this should be a bit easier.

looks like you have "Jump to Record" button on start form that pops up dialog for user to enter text, right?

Now, do the users know what form and record they want to see? Or just what record?

Pop up a dialog that contains:

list of forms, user choose form.
text box, user which record to find.

This dialog can work a few ways.

1. user choose form AND enter text.
2. user can choose form and optionally enter text.

1. will take this info, open/make/create form, search for record.

if (found)
{
//woohoo!
//show form and highlight/focus on proper record
} else
{
//boohoo!
//dialog box, "user no record found, here is requested form"
//show form and highlight/focus on first record
}

2. will:
//show form and highlight/focus on first record

either way, should be obvious that only enable 'OK'/'Show me the form/record' button only becomes enabled when user has chosen appropriate info.
qball is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Charges against non-tippers dropped.. (6)
Is It Just Me? (3055)
The disrespect of Obama by Russian .. (48)
Delete an OS (16)
Nvidia GTX 260 problem (8)
Laptop with wireless problem. (12)
Wireless Televisions. (12)
CPU fan stops spinning randomly (11)
windows vista security holes (17)
Regular Build (11)
windows 7 problem (7)
Internet Lost (5)
Point and Shoot Camera Suggestions. (6)
Print spooler problem (16)
Recent Discussions
Delete an OS (16)
Multiple Restarts Required at Boot (4)
cell phone won't work (0)
Nvidia GTX 260 problem (8)
Is the PSU I received dead? (15)
Can't open Word (12)
[F@H SPAM 11/16/09] ! 1/2 months to r.. (37)
Steam ID's, Gamertags etc... (4)
Games, Cables, PCI cards, and more fo.. (6)
Dept. of HS: NSA 'Helped' Develop Vis.. (17)
Linksys WMP54GS wireless card problem.. (5)
windows vista security holes (17)
Help getting around port 80 for camer.. (5)
Skillsoft Network+ Study Software Que.. (10)
Browsers wont load websites (3)
help me pls laptop just stopped worki.. (0)
Open With ..... Win7 (3)
Laptop with wireless problem. (12)
Internet Lost (5)
virus blocking exe. files (1)
Point and Shoot Camera Suggestions. (6)
CPU fan stops spinning randomly (11)
Modern Warfare 2: Who Bought It? (65)
Print spooler problem (16)
Kingston Bluetooth Dongle Driver (1)


All times are GMT -4. The time now is 10:40 PM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28