Help! (1 Viewer)

drm83

New member
Local time
Today, 13:00
Joined
Feb 23, 2024
Messages
4
Hi All, I am new to the site and newish to Access, but do have vba experience. In desperate need of help with the following:-

In a form, I want to display the field "LeadName" of the first record from table DirectBooking into Textbox1. On the same form, i want to display the same data of record 2 in textbox2, then the same for record 3 and 4.

in excel, i would use a vba loop to populate the boxes, but i am not sure how to do this. do i need to use vba or can i create an expression in the control to do what i need?

Thank you in advance for your help

Darren
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 20:00
Joined
May 7, 2009
Messages
19,245
use a Form (datasheet or Continuous form) against your table.

EDIT:

use a Query to Join your table and the other table that contains the the Leadname.
use this query as recordsource of your form.
 

GaP42

Active member
Local time
Today, 22:00
Joined
Apr 27, 2020
Messages
338
What do you define as the "first" record - what is the order based on?
Would a continuous form listing the records in the order specified by a query of the table suffice?
 

drm83

New member
Local time
Today, 13:00
Joined
Feb 23, 2024
Messages
4
Hi Both, thanks for your reply.

A continuous form I dont think will work for my project. a brief outline to what i am looking to acheive is create a room plan of bookings. When i click a comand button, i want the textboxes to move to a location using .left which i will have stored in the table - i will use a loop for this but this is the next stage. for now:

Upon loading the form, I will have say 20 textbox's number 1-20, and then each text box will load with the 'lead name' of each record from the table. (I will have this running for a query at a later date).

I hope that is a little clearer on the help i need?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 20:00
Joined
May 7, 2009
Messages
19,245
it's a little obscure for me.
look, i made a sample form (form1 and form2).
which one is close (or none).
 

Attachments

  • LeadMe.accdb
    544 KB · Views: 27

drm83

New member
Local time
Today, 13:00
Joined
Feb 23, 2024
Messages
4
Thank you so much for making the effort to help me here!

the form layout i need is form2

Basically on load, i want to populate text1 = Lead A, text2 = Lead B etc etc

in excel vba, i would set a loop to run from i=1-20 then populate the textbox, then move it to location then next i. I dont know if i can do the same here.

thank you again!
Darren
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 20:00
Joined
May 7, 2009
Messages
19,245
i already doing that. See the Open event of the Form.

do you want to save the 20 textbox. coz when you do you can just
use an Insert query before showing your form.
 

drm83

New member
Local time
Today, 13:00
Joined
Feb 23, 2024
Messages
4
I am sorry, i didnt see that as when i open the form, nothing is showing.

the vba is what i was expecting and thank you so much for this. However, my intention is to have this running from a query, so i need to amend the 1-20 with 1 being the first record (or line) of the query and 20 being the last......

i do want to save the textboxes, but not the values.

I have added a simple query to this file to demonstrate what i mean.

I really appreciate your help with this!!!

Darren
 

Attachments

  • LeadMe (1).accdb
    996 KB · Views: 29

Users who are viewing this thread

Top Bottom