Hello,
I am trying to use the FindRecord function in my 2003 database.
My code is - Dim Orderho As Integer
-
Orderho = Me.cboFindByOrder
-
Forms!test!Order!OrderID.SetFocus
-
DoCmd.FindRecord Orderho, , True, , True
It does not work when I use the variable, but will work if I put a number figure such as 12 in teh function for example - DoCmd.FindRecord 12, , True, , True
Is the problem with declaration of the variable?
Any help would be appreciated thanks
Peter
4 4073
The declaration should be of the same type as the field being searched, so guessing that OrderID is an autonumber, Autonumbers are Long
Assuming that Forms!test!Order is a subform, to refer to a control on it (such as OrderID) use -
Forms!test!Order.Form!OrderID
-
It's always worth putting a halt in your code, and checking whether Forms!test!.Form!Order is actually getting the focus
Phil
NeoPa 32,556
Expert Mod 16PB
You say it does not work, yet you don't tell us what does happen. An error description is helpful for errors. If it simply doesn;t find the correct record, or move the record pointer at all, we also need to know that.
Thank you for your replies,
I have changed the variable to Long and added the line of code
Forms!test!Order.Setfocus before
Forms!test!Order.Form!OrderID.SetFocus
to make sure that OrderID has the focus
but it still does not work. There are no error messages either but now OrderID has the focus.
Thanks
NeoPa 32,556
Expert Mod 16PB
I assume then that what you mean but not working must be that it doesn't move from the current record. I'm afraid I can't see why. I would assume that there is something which is causing it to fail but which you haven't shared with us.
Generally I would expect code such as that to work.
I can state unequivocally that the focus was fine in the first instance as when you used the literal value 12 it did work. So, it seems clear there is something about the variable used. You could try using Val() around the reference to your variable. That should work, but it isn't the answer to your question. We can only help with that when we know what it is you aren't telling us.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: vishal |
last post by:
hello friends
i have one php script which generates html page containing form. what i
want is submit this form using php script.
pls give me some idea that how can i submit form using php...
|
by: btopenworld |
last post by:
I am submitting a form using an image as the link to a js file.
The image calls a js function which checks fields- issuing alerts for
errors - if no errors it then submits the form.
I would like...
|
by: Justin Sane |
last post by:
I haven't been able to select a form using getElementById. I only can
select a form using the "name" property of the <form> tag. Is there
another way to select a form, or is it even possible to use...
|
by: Michael Creager |
last post by:
I am using VB NET 2002. How can I programmatically create a new windows
form using the value of a string variable as the name of the new form?
Public FrmName As String = "MDIChildFrm1"
Public...
|
by: San |
last post by:
Hey,
I need to create a form with several text boxes in which users type in
key words, press a command button on the form and it opens a matching
record. Thanking you in advance.
|
by: Renato Tasso |
last post by:
Please, everyone can help me ???
I wanna record DVD using visual basic.net language. How can i do ???
Thanks
--
Renato Tasso
|
by: alex.gruenther |
last post by:
I am new to Access and need help creating an edit record form. I've
got a table called Player with attributes like name, address, phone,
etc. I've created an edit player form with a combo box...
|
by: hollinshead |
last post by:
Hi there i have bit of an issue. i haver this database that is purely used for searching records under certain criteria. This criteria is chosen by the user on a form using list boxes and combo...
|
by: Joe Y |
last post by:
My Access DB handles product formulation and specification. In the formula form, many text boxes, such as Cost or ingredient statement, are calculated fields based on each ingredient data in the...
|
by: RachelleB |
last post by:
I have one tabbed form that links to a master table. One of these tabs links to a sub form (GRN, to GRN table) and another tab to another subform (SRN, to SRN table).
I can run a report that...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |