Need Help with Access (1 Viewer)

sledgehammer

New member
Local time
Yesterday, 22:28
Joined
Aug 10, 2021
Messages
3
This is some simple code I wrote. I run it through debug and get no errors. When I put quick watch in the debug they show <out of context>. I have tried everything I can think of and nothing works.

Public Sub txtGoto_Enter()
Dim MyString As String

Open "C:\Residents\Residentvb.accdb" For Input As #1
Do Until EOF(1)
Input #1, MyString
If gotolot = LotNo Then
End If

Loop

Close #1
End Sub
 

Gasman

Enthusiastic Amateur
Local time
Today, 06:28
Joined
Sep 21, 2011
Messages
14,253
Do you have Option Explicit at the top of your module?

What is this meant to do? :unsure:
Code:
If gotolot = LotNo Then
End If
 

sledgehammer

New member
Local time
Yesterday, 22:28
Joined
Aug 10, 2021
Messages
3
In the database is a field gotolot where I want to key in a number and find that number in Lotno which is also in the database. I am trying to do a random lookup. These are also fields in my form.
 
Last edited:

jdraw

Super Moderator
Staff member
Local time
Today, 01:28
Joined
Jan 23, 2006
Messages
15,377
What exactly are you trying to accomplish? A database has tables that have fields.
Typically you would have a form(s) to interact with data stored in tables.
Can you show us your table(s) structure(s), and a jpg of your form?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 01:28
Joined
Feb 19, 2002
Messages
43,257
You might be able to do what you want with a query. Link to the text file. Then create a query that joins the table to the linked textfile. Only the matches will be returned. The query will not be updateable because the linked text file is not updateable. If you need to update the existing table, you will need to import the text file and then join the imported table to the existing table.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 00:28
Joined
Feb 28, 2001
Messages
27,156
The loop you have written will run straight through that entire file because you have not tied anything of the input to your ending condition. You will reach the EOF every time. Is that what you wanted? Because that is what you wrote.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 13:28
Joined
May 7, 2009
Messages
19,228
an Access Database is not a Text file?
use Binary when you Open?

you create a Linked table on your db (if Residentvb.accdb is an external db)
to your db.

use DLookup() to get the value you want.
 

Users who are viewing this thread

Top Bottom