Problem coding forms to feed tables (1 Viewer)

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 07:29
Joined
Jul 9, 2003
Messages
16,271
Re:- Me.cmbGender

It seems very odd to me that you are accessing a command button in an SQL Statement?

Is it a command button? Or is it something left over from a previous version of your code?

If it is a command button I would be very interested in understanding what it does.
 
Last edited:

idforgod

Registered User.
Local time
Yesterday, 23:29
Joined
Dec 20, 2018
Messages
10
Thanks guys I really appreciate you efforts in finding solution to my question.
I just discovered a simplest way to do that using macro instead of VB codes.
 

idforgod

Registered User.
Local time
Yesterday, 23:29
Joined
Dec 20, 2018
Messages
10
Hello guys am pretty new in access as well as VB.

Please I need help again.

I populated my textboxes in form using [combobox].[column](1) in the control source of each text box and it works like magic but now the problem is that I can't edit that same to inputs remotely.
It seem the combo box deny me access .
Is there anything I can do?

I will appreciate if there is any solution thanks
 

isladogs

MVP / VIP
Local time
Today, 07:29
Joined
Jan 14, 2017
Messages
18,209
Two things
1. It might help others reading this thread if you posted how you solved your original problem
2. I'm not quite sure what your new problem is so forgive me if I've misunderstood.
If each of your textboxes are bound to a column from a combo, then you cannot set the value using code or by direct data entry. By binding these to another control you have indeed 'locked them' as the combo value determines the textbox value.
 
Last edited:

idforgod

Registered User.
Local time
Yesterday, 23:29
Joined
Dec 20, 2018
Messages
10
Ok @isladogs I will post the macro when my PC come alive.
But what I want to do is to be able to populate one form through two source, one being combobox and the other from manually entering the value,

Is there any way I can do that?
I really appreciate if anyone can help.
 

isladogs

MVP / VIP
Local time
Today, 07:29
Joined
Jan 14, 2017
Messages
18,209
It seems a strange idea to me but one way would be to use an unbound textbox so it could be populated manually.
Then use code similar to this

Code:
Private Sub Combo0_AfterUpdate()
If Nz(Me.Text2, "") = "" Then Me.Text2 = Me.Combo0.Column(1)
End Sub

That would update the textbox if it was empty but not if already populated
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 02:29
Joined
Feb 19, 2002
Messages
43,213
@idforgod,
Access is a RAD (Rapid Application Development) tool. Although you can use it to create your own unbound forms, why??? What do you think is better about writing and testing all your custom code than using the built in features?

Best practice for working with Access is to let Access be Access and do the things it does well and essentially free, and save yourself to code the things that only you can do such as implement the application's business rules.

It is quite easy to create filters for forms that the form's RecordSource query can reference. One example might be a form that looks up customers by CustomerNumber or LastName. The query would be:

Select ...
From ...
Where CustomerNumber = Forms!yourform!txtCustomerNumber OR CustomerName = Forms!yourform!txtCustomerName;

Use a button on the form to activate the search. The code would be:
Me.Requery
 

Users who are viewing this thread

Top Bottom