Invoking Table/Query cells in VBA (1 Viewer)

Heron

New member
Local time
Today, 07:01
Joined
Feb 4, 2002
Messages
8
Thanks, Anna, for your prompt response. Sorry if I appear dumb, but this is my first VBA day although I have two year’s experience in designing in Access 2000 the conventional way (tables, queries etc). I tried the code below incorporating your suggestion and it locked on the very first line. I want to get values (integers) from fields M1-M12 in Table “tB” and display them in TextBoxes “Jan – Dec”on a form. What is wrong with my code, please?

Unfortunately, all the books I’ve seen do not make it very clear which are reserved commands and which are just names. Also, do you need to Dim a value if the value type has already been declared in a table?

I need to bill monthly on within X period and within Y budget. Later I will do calculations on them with quite a bit of logic and itineration (carrying balances forward) and lots of date manipulation. THEN I need to get data OFF the Module and onto other tables or queries maybe.

By the way, the reason why I am plunged suddenly into VBA is that every time I try to do a lot of itineration combined with logic statements in a query I get the error “Query is too complex” (Error #3360) I’ve posted questions about this but never got a response. I’ve given up trying to use queries for this section of the database.

I wrote:-

Option Compare Database
Private Sub Form_Load()

Dim CurrentDb.TableDefs("tb").Fields("M1").Value as integer ‘January Input
Dim CurrentDb.TableDefs("tb").Fields("M2").Value as integer ‘February Input
Repeat until Field M12 incl.

For fc = 1 To 12
M(fc)= TextBox M(fc)

Next M(lc)

End Sub
 

simongallop

Registered User.
Local time
Today, 07:01
Joined
Oct 17, 2000
Messages
611
Are you trying to take info from 12 columns at row X? If so then this is a recordset and you would need to find the row that you want and then take the info from that row to your form. Hope that the table has a unique column ie an ID field of some description to be able to get to the correct row.

If I am on the right track and you need help then repost but might take 24hrs as am in UK
 

Heron

New member
Local time
Today, 07:01
Joined
Feb 4, 2002
Messages
8
Thanks, Harry, for responding. My posting should have been a thread on the same subject 13 postings previously, first replied to by "Anna". That may make more sense. Thanks again.
 

Users who are viewing this thread

Top Bottom